Need help with IF statement

Barry Katcher

Well-known Member
Joined
Feb 25, 2002
Messages
4,053
In cell A1, I have a 4 digit number. If that number is between 5000 and 5999, I want YES to appear in cell B1. If the number is less than or more than that range, I want NO to appear in B1. In Lotus, I would have used this formula in B1:

@IF(A1>4999#AND#A1<6000,"YES","NO")

with #AND# being the operative to give me the range. I can't find the equivalent operative in Excel. Excel's AND function doesn't provide for a range and it only returns true or false. Can anyone help me, I'm sure it's possible and easy, just can't seem to locate it.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
On 2002-10-03 08:33, Barry Katcher wrote:
In cell A1, I have a 4 digit number. If that number is between 5000 and 5999, I want YES to appear in cell B1. If the number is less than or more than that range, I want NO to appear in B1. In Lotus, I would have used this formula in B1:

@IF(A1>4999#AND#A1<6000,"YES","NO")

with #AND# being the operative to give me the range. I can't find the equivalent operative in Excel. Excel's AND function doesn't provide for a range and it only returns true or false. Can anyone help me, I'm sure it's possible and easy, just can't seem to locate it.

=(A1>=5000)*(A1<=5999)

Custom format the formula cell as:

[=0]"NO";[=1]"YES"
 
Upvote 0
Thanks, LAS, worked great. Curious, though. I entered 5500 in A1 and changed the formula in B1 to:

=IF(AND(A1=5000,A1=5500),"YES","NO")

and it return NO. Any idea why?
 
Upvote 0
it is not possible for a1 to be both 5000 and 5500 so it will always say NO.
 
Upvote 0
It returned NO because natutrally enough it couldn't satisfy both criteria i.e. it couldn't equal both 5000 and 5500
 
Upvote 0
Aladin - doesn't work. 5500 returns a zero, not a one. What is the * symbol. Is it a multiplier or the symbol for "and"?
 
Upvote 0
O.K, thanks, Bisley & Bolo. If I understand correctly, it satisfied the less than/more than criteria but not both the equal to criteria.
 
Upvote 0
On 2002-10-03 09:07, Barry Katcher wrote:
O.K, thanks, Bisley & Bolo. If I understand correctly, it satisfied the less than/more than criteria but not both the equal to criteria.

If you did want either case, simply substitute
OR for ANDin the "traditional" formula
or
+ for * in Aladin's boolean formula.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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