multiple if conditions

naciovica

New Member
Joined
Feb 4, 2019
Messages
4
Good day!
i have a table with 4 columns.
col1 col2 col3 col4
Please help me with a formula that outputs the following:
col1=empty & col2=empty & col3=empty & col4=empty => output a
col1>0 & col2=empty & col3=empty & col4=empty => output b
col1>0 & col2>0 & col3=empty & col4=empty => output c
col1>0 & col2>0 & col3>0 & col4=empty => output d
col1>0 & col2>0 & col3>0 & col4>0 => output e
i've tried all the if/and and if/or formulas but i don't find the solution.
Thanks in advance.
Have a nice day!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi there, try something like this:

=IF(AND(A2=0, B2=0, C2=0, D2=0), "a", IF(AND(A2>0, B2=0, C2=0, D2=0), "b", IF(AND(A2>0, B2>0, C2=0, D2=0), "c", IF(AND(A2>0, B2>0, C2>0, D2=0), "d", IF(AND(A2>0, B2>0, C2>0, D2>0), "e", "")))))
 
Upvote 0
What happens if values are less or equal to 0???
Normally you could use nested IFs. But here you present 5 cases, while there is total of 2^4=16 possible combinations (excluding possibilities for 0 and negative numbers).
The simplest way to achieve what you presented IMO is:

Code:
=IF(AND(ISBLANK(col1),ISBLANK(col2),ISBLANK(col3),ISBLANK(col4)),output a,
IF(AND(col1>0,ISBLANK(col2),ISBLANK(col3),ISBLANK(col4)),output b,
IF(AND(col1>0,col2>0,ISBLANK(col3),ISBLANK(col4)),output c,
IF(AND(col1>0,col2>0,col3>0,ISBLANK(col4)),output d,
IF(AND(col1>0,col2>0,col3>0,col4>0),output e)
))))
This must all go in a single line formula. However there are a lot of possibilities unaccounted for - in these cases the formula will evaluate to FALSE.
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top