if? or? then? I need help.

rd7742

New Member
Joined
Oct 22, 2017
Messages
2
I need cell X to have one of three possible outcomes, 1,2, or 3, all depending on whether cell Y or Z are populated with any value.

Cell X=1 if cell Y and Z are blank.
Cell X=2 if cell Y is populated and Z is blank
Cell X=3 if Cell Y and Cell Z are populated.

Any help is greatly appreciated.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Welcome to the Board!

Try (for row 1):
Code:
=IF(AND(Y1="",Z1=""),1,IF(AND(Y1<>"",Z1=""),2,IF(AND(Y1<>"",Z1<>""),3,"No conditions met")))

Note you did not mention what to return if Y is blank and Z is populated. In that case, it will return "No conditions met".
 
Upvote 0
Ah, thank you. Formula worked. So the "<>" represents any value?
="" means "equals nothing" (essentially is blank)
<>"" means "NOT equal to nothing" (essentially, is not blank)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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