Nested If Function

DOH Guy

New Member
Joined
Sep 22, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello All, I have having great difficulty trying to find the right formulas in excel to do what I want it to do. I am trying to have a If function formula switch between which formula to use based off another cell.

Like this, I want the cell to use this function if B12 has the color "White" selected. =IF(B12="White",IF(G1>189,"Pass","Fail")) but if B12 has the color "Yellow" selected I want the same cell to use this function IF(B12="Yellow",IF(G1>142,"Pass","Fail")). As you can see it is the same formula but the only differences are the colors and the "IF" function of G1. How can I have the same cell (I1) choose which formula to use based upon what color is selected in B12. If G1's average is above 189 while the color white is selected it passes at the same time if G1's average is above 142 while the color is y yellow it passes.

In the end how can I have the same cell choose which formula to used based upon what color is selected in B12.

I hope this makes sense. Here is formula I come up with but it does work but only in my head lol. Where am I wrong and how can I make this work

=IF(B12="White",IF(G1>189,"Pass","Fail")), IF(B12="Yellow",IF(G1>142,"Pass","Fail"))
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You could try this:

Excel Formula:
=IF(B12="White",IF(G1>189,"Pass","Fail"),IF(B12="Yellow",IF(G1>142,"Pass","Fail"),""))

But I prefer this:

Excel Formula:
=IF(OR(AND(B12="White",G1>189),AND(B12="Yellow",G1>142)),"Pass","Fail")
 
Upvote 0
You could try this:

Excel Formula:
=IF(B12="White",IF(G1>189,"Pass","Fail"),IF(B12="Yellow",IF(G1>142,"Pass","Fail"),""))

But I prefer this:

Excel Formula:
=IF(OR(AND(B12="White",G1>189),AND(B12="Yellow",G1>142)),"Pass","Fail")
AWESOME! That worked perfectly! Thank you so much. I have been busting my brain back and forth all day trying to figure that out. Thank You
 
Upvote 0
AWESOME! That worked perfectly! Thank you so much. I have been busting my brain back and forth all day trying to figure that out. Thank You
You're welcome, I am happy to help.
 
Upvote 0
If you want to make it more scalable then you could do something like this.
(Ideally make the lookup table an actual Excel table so that the formula automatically includes additional rows as you add them)

Book2
ABCDEFGH
1Score200
2Pass/FailPass <--- Result
3
11
12ColourWhiteColourPass threshold
13White189
14Yellow142
Sheet1
Cell Formulas
RangeFormula
G2G2=IF( G1>VLOOKUP(B12,$F$13:$G$17,2,FALSE), "Pass", "Fail" )
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,740
Members
452,940
Latest member
rootytrip

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