I'm trying to print the word NO in the input if a condition is false. Here is what I'm currently trying
=IF (A2="a")AND(b2="b", "YES","NO")
It seems like this would work but I keep getting this error | Formula parse error.
I'm new to EXCEL and I have no idea what I'm doing wrong? Any help would be great Thanks!
You were close. Try this
=IF(AND(A2="a",B2="b"),"YES","NO")
Use If() and AND like this:
=IF(AND(A2="a",b2="b"),"Yes","No").
Pay special attention to the closing ) in And(), I've frustrated myself many times by forgetting that and wondering why my If formula wasn't working.
Format the cell with a custom format
[=1]"YES";"NO"
Then convert the formula result in the cell to an integer.
=INT(AND(A2="a",B2="b"))
Related
I am a beginner at using Excel and I've been trying to code a particular condition. The condition is as follows,
If A<75 and B<75 then do nothing
If A>75 and B<75 then A-75
If A<75 and B>75 then B-75
If A>75 and B>75 then (A-75)+(B-75)
Here, A and B are numerical values in two different cells.
So I wrote a formula and it works when the IF statements are not nested. However when I combine the formula it gives me an error. The formula I wrote is as follows.
=IF(AND(S180<75,V180<75),0,"-",IF(AND(S180>75,V180<75),S180-75,"-",IF(AND(S180>75,V180<75),S180-75,"-",IF(AND(S180>75,V180>75),(S180-75)+(V180-75),"-"))))
The formulae that work are as follows,
=IF(AND(S180<75,V180<75),0,"-")
=IF(AND(S180>75,V180<75),S180-75,"-")
=IF(AND(S180>75,V180<75),S180-75,"-")
=IF(AND(S180>75,V180>75),(S180-75)+(V180-75),"B")
I want the conditions to all be applied in a single cell so that I can switch the resulting value into standard values from another table using the =switch function. I am using Excel Online. Any help fixing my formula is welcome.
Thanks in Advance!
With IF, but could be shortened:
=IF(AND(S180>75,V180>75),S180+V180-150,IF(AND(S180>75,V180<75),S180-75,IF(AND(S180<76,V180>75),V180-75,IF(AND(S180<75,V180<75),""))))
Do you have a recent version of Excel with the IFS function?
=ifs(AND(S180<75, V180<75), 0, AND(S180>75, V180<75), S180-75, AND(S180>75, V180<75), S180-75, AND(S180>75, V180>75), (S180-75)+(V180-75), TRUE, "B")
If you try this formula and end up with a #NAME? error then your version does not support IFS.
Try this nested IF ,
To nest IF you need to include another IF in the FALSE condition of the first IF
=IF(AND(S180<75,V180<75),0,IF(AND(S180>75,V180<75),S180-75,IF(AND(S180>75,V180<75),S180-75,IF(AND(S180>75,V180>75),(S180-75)+(V180-75),"-"))))
This is a formula I'm using in a Gantt/time-line chart to drive different values to a cell:
=if(AND((K$3>=$G8),(K$3<=$H8)),if((ROUNDDOWN($J8*$I8)<=(K$3-$G8)), "X", "Y"),"")
It works fine in Google Sheets, but when pasted into Excel, it throws an error that says "Not enough arguments were entered for this function."
Is there an easy way to fix this?
your roundown part is missing an argument. try this =IF(AND((K$3>=$G8),(K$3<=$H8)),IF((ROUNDDOWN($J8*$I8,0)<=(K$3-$G8)),"X","Y"),"")
I was able to just add a comma after J8*I8, and that seemed to solve the issue. Excel required a digit there for some reason.
Hi I am trying to write a formula where if cell (J$4) = 1120 then it would run one statement, whereas if cell (J$4) = 1120s it would run another. I am using index-match to lookup the appropriate value. However, I can't seem to get my formula to work and I was wondering if you guys can find my error. The error is 'you've entered too many arguments for this function'. Any help would be appreciated! Thank you!
formula:
=IFERROR(IF(J$4="1120S",INDEX(B1HY3!$A$3:$F$300,MATCH("L 22a",B1HY3!$F$3:$F$300,0),5),IF(J$4=1120,INDEX(B1HY3!$A$3:$f$300,MATCH("L 22a",B1HY3!$f$3:$f$300,0),5)+INDEX(B1HY3!$A$3:$F$300,MATCH("L 22b",B1HY3!$F$3:$F$300,0),5),0),0)
Always try to follow parentheses' colors it is quite useful when handling with large formulas,furthermore try always to evaluate your formulas to check where the error is.
It worked for me:
=IFERROR(IF(J$4="1120S",INDEX(B1HY3!$A$3:$F$300,MATCH("L 22a",B1HY3!$F$3:$F$300,0),5),IF(J$4=1120,INDEX(B1HY3!$A$3:$F$300,MATCH("L 22a",B1HY3!$F$3:$F$300,0),5)+INDEX(B1HY3!$A$3:$F$300,MATCH("L 22b",B1HY3!$F$3:$F$300,0),5))),0)
It was nessesary to close the parenthesis of the second if
{=IF(ROWS(A$9:A223)<=A$1,INDEX(Tracker!A:A,SMALL(IF(Tracker!$R$3:$R$9610=A$2,ROW(Tracker!$A$3:$A$9610)),ROWS(A$9:A223))),"")}
I need the #NUM! not to show up. I can't figure out where the , "" goes. The function above is what I have so far. It is an Array. By the way, this works just fine. I just can't have the #NUM! showing up because count.... anything doesn't count it right. And what's up with Count counting the formulas in cells too?! Sorry, first question only. Thank you everyone!
Posting as answer from comments:
Use IFERROR like this:
=IFERROR(IF(ROWS(A$9:A223)<=A$1,INDEX(Tracker!A:A,SMALL(IF(Tracker!$R$3:$R$9610=A$2,ROW(Tracker!$A$3:$A$9610)),ROWS(A$9:A223))),""),"")
HTH.
I apologize if this is not considered real programming since it is in Excel but I need help and this is the most helpful place I know!
Alright so I have a very large if formula in excel:
=IF(AND(($EZ16+LF$1139)>$B$1145,($EZ16+LF$1139)<$B$1146),IF(OR(AND($FB16<LF$1141,$FB16>LF$1142),AND($FE16<LF$1141,$FE16>LF$1142),AND($FH16<LF$1141,$FH16>LF$1142),AND($FK16<LF$1141,$FK16>LF$1142),AND($FN16<LF$1141,$FN16>LF$1142),AND($FQ16<LF$1141,$FQ16>LF$1142),AND($FT16<LF$1141,$FT16>LF$1142),AND($FW16<LF$1141,$FW16>LF$1142),AND($FZ16<LF$1141,$FZ16>LF$1142),AND($GC16<LF$1141,$GC16>LF$1142),AND($GF16<LF$1141,$GF16>LF$1142)),FALSE,(EU16/EI16-1)),FALSE)
What can I do to it so that if it returns a div/0 error it will pass a value of 0 instead of the #DIV/0! error?
Would it be something like:
=IF(ISERROR(A1/B1),0,A1/B1)
If so how can I add that to my current formula and not break it? Would it be:
=IF(ISERROR(IF(AND(($EZ16+LF$1139)>$B$1145,($EZ16+LF$1139)<$B$1146),IF(OR(AND($FB16<LF$1141,$FB16>LF$1142),AND($FE16<LF$1141,$FE16>LF$1142),AND($FH16<LF$1141,$FH16>LF$1142),AND($FK16<LF$1141,$FK16>LF$1142),AND($FN16<LF$1141,$FN16>LF$1142),AND($FQ16<LF$1141,$FQ16>LF$1142),AND($FT16<LF$1141,$FT16>LF$1142),AND($FW16<LF$1141,$FW16>LF$1142),AND($FZ16<LF$1141,$FZ16>LF$1142),AND($GC16<LF$1141,$GC16>LF$1142),AND($GF16<LF$1141,$GF16>LF$1142)),FALSE,(EU16/EI16-1)),FALSE))**),0,IF**(AND(($EZ16+LF$1139)>$B$1145,($EZ16+LF$1139)<$B$1146),IF(OR(AND($FB16<LF$1141,$FB16>LF$1142),AND($FE16<LF$1141,$FE16>LF$1142),AND($FH16<LF$1141,$FH16>LF$1142),AND($FK16<LF$1141,$FK16>LF$1142),AND($FN16<LF$1141,$FN16>LF$1142),AND($FQ16<LF$1141,$FQ16>LF$1142),AND($FT16<LF$1141,$FT16>LF$1142),AND($FW16<LF$1141,$FW16>LF$1142),AND($FZ16<LF$1141,$FZ16>LF$1142),AND($GC16<LF$1141,$GC16>LF$1142),AND($GF16<LF$1141,$GF16>LF$1142)),FALSE,(EU16/EI16-1)),FALSE))
Thank you for the help!
EDIT:
Tim a tried your suggestion:
=IF(AND(($EZ16+LF$1139)>$B$1145,($EZ16+LF$1139)<$B$1146),IF(OR(AND($FB16<LF$1141,$FB16>LF$1142),AND($FE16<LF$1141,$FE16>LF$1142),AND($FH16<LF$1141,$FH16>LF$1142),AND($FK16<LF$1141,$FK16>LF$1142),AND($FN16<LF$1141,$FN16>LF$1142),AND($FQ16<LF$1141,$FQ16>LF$1142),AND($FT16<LF$1141,$FT16>LF$1142),AND($FW16<LF$1141,$FW16>LF$1142),AND($FZ16<LF$1141,$FZ16>LF$1142),AND($GC16<LF$1141,$GC16>LF$1142),AND($GF16<LF$1141,$GF16>LF$1142)),FALSE,IF(EI16=1,0,EU16/EI16-1)),FALSE)
Still getting a #DIV/0 error, any idea why?
Excel 2007 has a new IFERROR function that you can use like
=IFERROR(MyLongFormula,0)
=IsError(100/0) will return TRUE, so make the conditional before to output 0, =IF(IsError(*),0,...)
I wouldn't recommend duplicating the whole formula like that: a complicated formula just got twice as complicated.
Since the division only happens in one place, I'd recommend putting the check there. This:
...(EU16/EI16-1)...
becomes this:
...IF(EI16=1, 0, EU16/EI16-1)...