I'm trying to return a value in Google sheets.
This is done using an Index Match as follows, which does work:
=iferror(index(Data!B:B, match(B5339,Data!G:G,0)),"Not Found")
I'd now like to expand this, so that if this first test fails, try looking up that same data in another sheet....
=iferror(if(index(Data!B:B, match(B5340,Data!G:G,0),if(index(HeadOfficeLeads!B:B, match(B5340,HeadOfficeLeads!A:A,0))))),"Not found")
This outputs the fail msg of "Not Found".
However, although the first test is indeed false, the second test is true (this second data set does in fact hold a match).
NB - the data containing this correct match on the 2nd sheet is created by a UNIQUE ( FILTER, FWIW....
For some reason, it doesnt look like the second IF statement is being run - and the whole thing doesnt work, giving the error "Wrong number of arguments".
I have a feeling the argument issue is that the first test doesnt have an "if false" clause - but believe the "IFERROR" parent should handle this?
If not, where would I put the "if false clause" for the IF's?
You don't need any if, because iferror already contains an if statement in its logic (as its name suggests). Here is an example of nested iferror statements, simplified for clarity:
=iferror(match("a", A1:A5, 0), iferror(match("a", B1:B5", 0), "not found"))
This will return the position of "a" in column A, if it's there; otherwise, it will return its position in column B if it's there, otherwise it returns "not found".
Works the same with index or anything else around match function.
Related
I have a question on using two functions with an if statement in Google Sheets as one complete function. Both variables have to be true, otherwise it returns false. I need one function to check the date 20 months back from today. If said cell is less than today's date 20 months back it's true, naturally. However, for the complete function to return true it also searches for another text value in another cell and has to be an exact match. Both conditions have to be true (the date and the exact match) for the function to be true. So if the date in the cell is less than today's date 20 months back and the text value in the other cell is an exact match, function is true.
Problem is that it seems like the date function does not seem to apply.
=IF(D2<DATE(YEAR(TODAY()),MONTH(TODAY())-20,DAY(TODAY())),AND(REGEXMATCH(M2,"text")),TRUE,FALSE)
You current formula is not set up correctly (nor logically). Given only what you've shown here, this should work:
=IF(AND( D2<DATE(YEAR(TODAY()),MONTH(TODAY())-20,DAY(TODAY())), REGEXMATCH(M2,"text") ),TRUE,FALSE)
Notice that the AND( ) contains both conditions here, whereas your original formula had it only around the second condition.
However, a shorter version of this would be as follows:
=AND( D2<DATE(YEAR(TODAY()),MONTH(TODAY())-20,DAY(TODAY())), REGEXMATCH(M2,"text") )
... since the result of a properly functioning AND( ) is always TRUE or FALSE anyway.
It looks like you're supplying 4 arguments to the IF statement:
=IF(DATECHECK,AND(TEXTCHECK),TRUE,FALSE)
The IF statement expects 3 arguments instead. 1) the condition, 2) the value if true, and 3) the value if false. You can combine your two conditions using an AND statement like this:
AND(DATECHECK,TEXTCHECK)
The final formula would then be:
=IF(AND(D2<DATE(YEAR(TODAY()),MONTH(TODAY())-20,DAY(TODAY())), REGEXMATCH(M2,"text")),TRUE,FALSE)
My current formula populates Missed, Meets, Nearly Meets, and Exceeds. But I can't seem to figure out how to include "N/A" or create a blank cell in the formula.
My forumla so far:
=if(AND(L40>=14.5, L40<=16.4),"Nearly Meets", if(AND(L40>=4.5, L40<=14.4),"Meets", if(AND(L40>=15.5),"Missed","Exceeds")))
So, if L40 has any range of these number, M40 populates any of these Texts. How can I add to the formula so a blank cell populates "N/A" . Or, entering "TBD" in a cell leaves it blank or populates "N/A"
I'd rather use IFS formula or VLOOKUP here. It's short and clear.
=ifna(vlookup(B2,F2:G6,2,true),"value not found")
On a side you make a table of requirements and go through it using vlookup.
If you have no space anywhere in your sheet, you can also include value table into your formula using curly brackets:
=ifna(vlookup(B2,{0,"Missed";4.5,"Nealry Meets";14.4,"Meets";15.5,"Exceeds";"","Empty"},2,true),"value not found")
For values outside the set you can use IFNA formula.
If you use indentation before writing the final formula, it looks like this:
if(AND(L40>4.4; L40<=16.4){
"Nearly Meets";
}
else if(AND(L40>=4.5; L40<=14.4){
"Meets";
}
else if(L40>16.4){
"Missed";
}
else if(L40 = ""){
"N/A";
}
else {
"EXCEEDS"
}
Notice that I didn't use the condition if(L40<4.5), because a blank cell can be interpreted as 0, which is always less than 4.5, so you would never reach the N/A condition. By better determining your ranges, it gets easier to escape the exceeds case. It may not be your case, but if you had 2 or more digits after the decimal point, it could give you an unexpected result.
That said, you can now use the formula as
=if(AND(L40>4.4, L40<=16.4), "Nearly Meets", if(AND(L40>=4.5, L40<=14.4), "Meets", if(L40>16.4, "Missed", if(L40 = "", "N/A", "EXCEEDS"))))
I am getting two values one is printing Cash and other is printing CASH in sap crystal report. Now, I want that wherever Cash is showing at that time value should be false while if CASH is printing then the value should show true. So, for that I added the formula but didnt work,
here is my formula,
if(ProperCase({TmpSalesBillInstallmentReport.PaymentType}) = true)
then {TmpSalesBillInstallmentReport.PaymentType}= '0'
else if(UpperCase({TmpSalesBillInstallmentReport.PaymentType}) = true)
{TmpSalesBillInstallmentReport.PaymentType} = '1'
This formula is not working, even getting error i.e. A Boolean Is Required Here(indicating on the first line)
I surfing in net but didnt get related question also.
IF {TmpSalesBillInstallmentReport.PaymentType} = "CASH" Then True ELSE False;
Note: A Crystal formula cannot assign a value to a database field. The field value is Read Only!
UpperCase() function is not a test that returns true or false. It simply returns the text argument after converting it to all upper case.
You might have a setting causing comparisons to be case insensitive.
See: http://www.plumblineconsulting.com/crystal-reports-and-case-sensitivity-of-database-records/
In a Google Sheet I want to compare two dates and check if either one (Plan start date, actual start date) is blank. It should show the text "not started" then. If not if(plan start date <Actual start date) show as Delay else "Inline":
=if((DAYS360(D8,C8)<0,"Delay","Inline",IF(ISBLANK(D8),"Not started")))
This didn't work. Can anyone help?
Try this
=IF(DAYS360(D8;C8)<0;"Delay";IF(ISBLANK(D8);"Not started";"Inline"))
Use semicolons in Excel, not commas. Also, the IF conditionals are written like this:
=IF(condition; value if true; value if false)
If you write more than 3 parameters it just won't work. You can put an IF inside of a value parameter so you nest two IFs (or as many as you wish)
EDIT: ok I thought it was an Excel and not a google spreadsheet. Maybe there you can use commas. The rest is the same though, you had a mistake in the IF statement. =IF(DAYS360(D8;C8)<0,"Delay",IF(ISBLANK(D8);"Not started","Inline")) should do the work.
You have a syntax error:
=if(
(
DAYS360(D8,C8)<0,
"Delay",
"Inline",
IF(
ISBLANK(D8),
"Not started"
)
)
)
Your outer IF has 4 arguments, while the proper syntax is: IF( condition, result if true, result if false) and the 3rd argument is optional.
EDIT: As far as I understand, you might want to achive something like this:
IF(
OR(ISBLANK(C8), ISBLANK(D8)),
IF(
ISBLANK(C8),
"first is blank",
"second is blank"
),
"none of them is blank"
)
And in the "none of them is blank" case you may want to place an additional IF examining DAYS360(C8, D8).
How would I do:
FinancialStatements.objects.get(statement_id=statement_id)
or SalesStatements.objects.get(statement_id=statement_id)
The result will always yield one result.
I ended up using the try/except route here:
try:
statement_object = FinancialStatements.objects.get(statement_id=statement_id)
except FinancialStatements.DoesNotExist:
statement_object = SalesStatements.objects.get(statement_id=statement_id)
Why not simply do:
result = (FinancialStatements.objects.filter(statement_id=statement_id) or
SalesStatements.objects.filter(statement_id=statement_id))
This should work, because filter returns a list - and an empty list if no entries match. An empty list evaluates to false in python's boolean logic, e.g. try running:
print [] or "hello"
(Just as a check, compare print ["Hi"] or "hello")
So, if the first query returns empty, the second will then be run. However, if the first matches anything, this will be result and the second query will be ignored.
Addendum: result will then be of a list type - you'll need to extract the (one and only) element with result[0].