If Statement issue

xsmurf

Board Regular
Joined
Feb 24, 2007
Messages
55
Office Version
  1. 365
Platform
  1. Windows
Hi Experts,

I have a question regarding an IF-Statement.

If have 3 cells (U3 / U4 / U5) and these cells retrieve information from a different workbook, this work perfect.
My goal is to give a value in cell V3 depending on the information in those 3 cells.
There are only 3 options possible in cell U3 / U4 / U5, which are "Yes", "No" or blank/empty.
The IF statement in cell V3 should do the following:
- If all the values are "No", cell V3 should say "No"
- If there is a "Yes" in any of the 3 cells, cell V3 should say "Yes"

The IF-statement that I have is doing that without any issues, however when 1 of cells is empty cell V3 is empty.
This is where I have my problem.

How can I modify the IF-statement that it will ignore the blanks but will still give the proper answer?

My code:
VBA Code:
=IF(AND(U3:U5<="No"),"No",IF(OR(U3:U5="Yes"),"Yes",""))

Thank you for the help
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
This statement makes no sense to Excel:
Excel Formula:
U3:U5="Yes"

If you want to check to see if all three cells are equal to "Yes", use:
Excel Formula:
COUNTIF(U3:U5,"Yes")=3

If you want to check to see if ANY of the cells are equal to "Yes", you can use:
Excel Formula:
COUNTIF(U3:U5,"Yes")>0

Armed with this new knowledge, I will leave it up to you to update those parts of your formulas.
If you still have issues, post your updated formula attempt here.
 
Upvote 0
How about
Excel Formula:
=IF(COUNTIFS(U3:U5,"Yes"),"Yes",IF(COUNTIFS(U3:U5,"No")=3,"No",""))
 
Upvote 0
I had to adjust the code a little, but this one works perfect
thank you @Fluff & @Joe4

VBA Code:
=IF(COUNTIFS(U3:U5,"Yes"),"Yes",IF(COUNTIFS(U3:U5,"No")>=1,"No",""))
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

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