if logical formula

debbieharvey

New Member
Joined
Aug 10, 2019
Messages
2
Hi excel gurus
I need a formula that will return a value of 1 in a cell, if the contents of another cell are between 2 ranges, ie, it needs to return a value of 1 if the test cell contains any number between 60 and 64 or 86 and 90. if the value in the test cell is not within these 2 ranges, it needs to return a value of 0... I have tried using if(and but can only get it to work for 1 range of values, not 2. perhaps there is an easier way? this is for setting up colour formatting in KPIs.. so once I get this sorted, the rest should be a breeze.. thanks in advance
DH
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Does this work?

=IF(OR(AND(F2>=60,F2<=64),AND(F2>=86,F2<=90)),1,0)

Result
Number
055
066
077
1
88
099
1
60
164
186
190

<colgroup><col style="width:48pt" width="64" span="2"> </colgroup><tbody>
</tbody>
 
Upvote 0
Another option
=--OR(AND(A2>=60,A2<=64),AND(A2>=86,A2<=90))
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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