Nested If formula with two AND conditions

adrienne0914

Board Regular
Joined
Mar 22, 2018
Messages
57
Office Version
  1. 2016
Platform
  1. Windows
I always have trouble with nested IF AND formulas. Trying to figure out how to combine the two formulas below based on whether a number falls between these two sets of numbers:

AB
11113
22325

<tbody>
</tbody>

=IF(AND(N$3>=$A$1,N$3<=$B$1),"PY last 3","") and =IF(AND(N$3>=$A$2,N$3<=$B$2),"last 3","")
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi,

Just Nest the 2nd IF in the 1st:

=IF(AND(N$3>=$A$1,N$3<=$B$1),"PY last 3",IF(AND(N$3>=$A$2,N$3<=$B$2),"last 3",""))
 
Upvote 0
Hi,

Just Nest the 2nd IF in the 1st:

=IF(AND(N$3>=$A$1,N$3<=$B$1),"PY last 3",IF(AND(N$3>=$A$2,N$3<=$B$2),"last 3",""))

That returns a result of PY last 3 to all cells >= A1. I need for it to be blank if the number isn't between either range.
 
Last edited:
Upvote 0
Well, it works for me, are you certain you have Numeric values in N3, A1, B1, A2, B2 ??


Book1
ABCNOPQRS
11113
22325
3231115222724
4last 3PY last 3last 3
Sheet593
Cell Formulas
RangeFormula
N4=IF(AND(N$3>=$A$1,N$3<=$B$1),"PY last 3",IF(AND(N$3>=$A$2,N$3<=$B$2),"last 3",""))
 
Upvote 0
Well, it works for me, are you certain you have Numeric values in N3, A1, B1, A2, B2 ??


<tbody></tbody>

It works now. The cells in my document were actually different from those above. I didn't change all of the cell references properly. Thanks, jtakw! :)
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,046
Members
449,063
Latest member
ak94

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