IF and/or statement, true/false results different

janesdtr

New Member
Joined
Feb 19, 2003
Messages
11
Hello everyone,

I am having trouble constructing a formula that looks for either of 2 conditions and then returns different true and false values, depending on the conditions. I can successfully construct the formula when the true or false condition is the same for the 2 conditions, but can't wrap my head around this more complicated scenario.

Here I go:

If a2>0 AND c2=yes, then return a2*2 (if true) or a2 (if false)
OR
if b2>0 AND c2=yes, then return b2*2 (if true) or b2 (if false)

Thank you in advance for any advice you scoot my way!

Mary Beth
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
although both could be true you cant have 2 different results in the same cell
which value would you want? a2*2 or b2*2
 
Upvote 0
What result do you expect in this scenario and why?

Excel Workbook
ABC
1
224yes
3
Sheet1
 
Upvote 0
Sorry for not giving context. This is used to track employee mileage expense.

We have mileages that are standard/pre-determined and we have mileages that employees compute from their odometers.

A2 (through a1000) is a VLookup that populates with a list of our standard mileages based on the location the employee chooses.
B2 (through b1000) is for computed mileages.
C2 (through c1000) asks whether it was a round trip.
D2 is the total mileage for the trip.

Formula in D2: If C2 says yes, then the formula in D2 doubles either a2 or b2. If C2 says no, D2 simply displays the value in a2 or b2.

Please let me know if you need more information. And...

THANKS!
 
Upvote 0
I can get this far, but this assumes the true and false answers are the same. Sadly, they're not.

=IF(OR(AND(A2>0,C2="yes"),AND(B2>0,C2="yes")),A2*2,A2)
 
Upvote 0
Will there only be a value in A2 or B2. If not, how is it supposed to pick which of the 2 values to use?
 
Upvote 0
I analyzed your query like this: Either [A2] or [B2] have the value but not both or supposed both have the value other than 0 then it will priorities the value in [A2].

[D2]=IF(C2="yes",IF(A2<>0,A2,B2)*2,IF(A2<>0,A2,B2))

Open for comments.
Thanks
 
Upvote 0
Only 1 of the 2 cells will have a value so you can add them together and get the 1 value. Then just check Column C for yes to see if you need to double that or not.

Excel Workbook
ABCD
277
399
410yes20
510yes20
Sheet1
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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