IF Statement Problem

Florida1510

New Member
Joined
Mar 13, 2020
Messages
35
Office Version
  1. 2010
Platform
  1. Windows
Good morning, I have been struggling with an IF formula I’m hoping someone can assist me with:
Issue - I have three different billing options:

1. Yes – Midwest
2. Yes – NE/SW/CAN
3. No

What I need for my formula to do is to look at the above three options in cell “I2” if the result in the field = options 1 or 2 I need formula to then put in the number shown in cell G2 (note cell G2 is also a formula I’m not sure if that matters) in cell H2. If “I2” = Option 3 of “No” I need for cell H2 to be populated with a “0”.

For the life of me I can’t seem to get this formula to work properly. Any help would be greatly appreciated. Thanks in advance.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
What are the exact values in I2?
 
Upvote 0
Assuming Only 1 of the 3 options can exist

in H2 put
=IF( OR ( I2 = "Yes – Midwest", I2 = "Yes – NE/SW/CAN"), G2, 0)

OR
=IF( I2 = "NO", 0, G2 )
 
Upvote 0
I think you just need
Code:
=--(I2="No")*G2
-- converts TRUE into 1 and FALSE into 0, i.e. 1 * G2 (if not option 3) or 0 * G2 (if it is option 3)
 
Upvote 0
Thank you Thank you Thank you JackDanlce that worked perfectly. I really appreciate everyone’s response and so quickly that’s awesome. Thanks again much appreciated. Have a great day and stay safe everyone.
 
Upvote 0
I think you just need
Code:
=--(I2="No")*G2
-- converts TRUE into 1 and FALSE into 0, i.e. 1 * G2 (if not option 3) or 0 * G2 (if it is option 3)
=(I2="No")*G2

is enough without the "--". The "*G2" part is an acceptable function to convert the TRUE/FALSE to 1/0.
 
Upvote 0
Thanks @Eric W I did wonder about conversions and I think in the past it's not worked when I've not used -- but will check next time I need to :)
 
Upvote 0
Thanks @Eric W I did wonder about conversions and I think in the past it's not worked when I've not used -- but will check next time I need to :)
In theory, any arithmetic function (+, -, *, /, or the "double unary", --) is enough to convert TRUE/FALSE to 1/0. But I've also ran into cases where that doesn't seem to work without the --, requiring that I add the --, or rearrange the formula, or even add another set of parentheses somewhere. I can usually recognize the easy cases now, but with a complicated formula, I may have to experiment.
 
Upvote 0
Now it makes sense why I've stuck to using them than not. To be honest, I did think it's weird "1"+0 = 1 but I was needing to use --(1=1)*1 instead of just (1=1)*1

Good to know for simple cases can be dropped, probably a trial and error approach until figure out when need to use vs not, thanks again!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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