Excel 'IF' statement help
Discussion
I have a spreadsheet with 3 columns.
Column a will show either 'A' or 'B'
Column b will show either '1' or '2'
In column C I need:
"IF(column a=A & column b=1) then do this
"IF(column a=A & column b=2) then do this
"IF(column a=B & column b=1) then do this
"IF(column a=B & column b=2) then do this
How do I get that all into 1 IF statement? I can do basic IF & AND statements, but they usually have "if true do this, if false do this", but in this instance there won't be a 'false'.
Column a will show either 'A' or 'B'
Column b will show either '1' or '2'
In column C I need:
"IF(column a=A & column b=1) then do this
"IF(column a=A & column b=2) then do this
"IF(column a=B & column b=1) then do this
"IF(column a=B & column b=2) then do this
How do I get that all into 1 IF statement? I can do basic IF & AND statements, but they usually have "if true do this, if false do this", but in this instance there won't be a 'false'.
Hopefully I've understood correctly, in which case, use nested IFs. The false part of the IF becomes the start of another IF
https://exceljet.net/formulas/nested-if-function-e...
https://exceljet.net/formulas/nested-if-function-e...
Harpoon said:
Hopefully I've understood correctly, in which case, use nested IFs. The false part of the IF becomes the start of another IF
https://exceljet.net/formulas/nested-if-function-e...
That has worked perfectly, thankyou!https://exceljet.net/formulas/nested-if-function-e...
Instead of nested IF functions look at the IFS function:
https://support.microsoft.com/en-us/office/ifs-fun...
https://support.microsoft.com/en-us/office/ifs-fun...
alock said:
With lots of values, a switch might become easier to manage, e.g.
=SWITCH(CONCAT(A1,B1), "A1", "output for A+1", "A2", "output for A+2", "B1", "output for B+1", "B2", "output for B+2")
How long has the SWITCH function been around !!! Been using Excel for 25+ years and never noticed it before !=SWITCH(CONCAT(A1,B1), "A1", "output for A+1", "A2", "output for A+2", "B1", "output for B+1", "B2", "output for B+2")
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


