If statement with And issue

tm1274

New Member
Joined
Jun 18, 2022
Messages
19
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hello. I am trying to write an if statement including an "And" but then continue to run but I cannot seem to get it to work. I believe I need the "And" but there may be a better way. The and statement will look at 2 cells, to return blank if true like the following statement:
Excel Formula:
=IF(AND(OR(G4=B10,H4= B13),""
But if the result is false, I need to continue the statement to return a result based on the value in these same cells similar to:
Excel Formula:
IF(G4=B10,J10,IF(G4=B9,J9)
Combining the statements errors and I am not finding any examples of how to make this work. Can anyone tell me how to make this work?
 
I think I just over complicated my statement. I think it should be:
Excel Formula:
=IF(AND(G4=B10,H4=B13),"",IF(G4=B10,J10,J9))
 
Upvote 0
If that formula works for all combinations, then I guess you're done. If not, please describe the logic you want without using formulas to illustrate it.

This formula uses the same logic but factors out the repeated test. I have tested this to ensure it matches your formula's outcome for all combinations:
Excel Formula:
=IF(G4=B10,IF(H4=B13,"",J10),J9)
It's not "better" but some may prefer it to avoid the redundancy.
 
Upvote 0
Solution
If that formula works for all combinations, then I guess you're done. If not, please describe the logic you want without using formulas to illustrate it.

This formula uses the same logic but factors out the repeated test. I have tested this to ensure it matches your formula's outcome for all combinations:
Excel Formula:
=IF(G4=B10,IF(H4=B13,"",J10),J9)
It's not "better" but some may prefer it to avoid the redundancy.
Thanks. Your version is in my opinion better in that it is more simplified, and you are correct it worked well. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,226,795
Messages
6,193,046
Members
453,772
Latest member
aastupin

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