Nested If formula with two AND conditions

adrienne0914

Board Regular
Joined
Mar 22, 2018
Messages
73
Office Version
  1. 365
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:

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]11[/TD]
[TD]13[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]23[/TD]
[TD]25[/TD]
[/TR]
</tbody>[/TABLE]

=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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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 ??

[TABLE="width: 85%"]
<tbody></tbody>[/TABLE]

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,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