Checking Values in A range lie between 2 values .

PheoBlue

New Member
Joined
May 14, 2019
Messages
5
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,
I am working on a worksheet at the moment and have run across a small problem.

I have a table/Range with 12 values in it and i am looking to return a True/false, Pass /Fail, based upon the verification that the values lie between the values stored in 2 cells.
The 2 Cells are calculated values of Average +20% and Average -20% , and the test is to verify the values lie within the +/- 20% allowed.

0.81​
0.75​
0.89​
0.75​
0.78​
0.77​
0.65​
0.79​
0.74​
0.88​
0.88​
0.80​
0.77​
0.88​
0.89​

0.96
0.64

So the expected result should look at the cells within the table/Range and as long as the values Lie within 0.96 and 0.64 (+/-20%) it should Return True or Pass ...., etc and if Not it Should Return Fail, False, Etc .....
I have tried a few different things but nothing seems to return what I am looking to produce.
Am looking to do this with a function and not VBA if possible .

Thank You in advance for any assistance you may be able to provide.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi & welcome to MrExcel.
How about

Book1
ABCDE
10.810.750.890.750.78
20.770.650.790.740.88
30.880.80.770.880.89
4
50.96False
60.64
Data
Cell Formulas
RangeFormula
B5B5=COUNTIFS(A1:E3,">"&A5,A1:E3,"<"&A6)>0
 
Upvote 0
Hi & welcome to MrExcel.
How about

Book1
ABCDE
10.810.750.890.750.78
20.770.650.790.740.88
30.880.80.770.880.89
4
50.96False
60.64
Data
Cell Formulas
RangeFormula
B5B5=COUNTIFS(A1:E3,">"&A5,A1:E3,"<"&A6)>0
cap1.PNG

Thank you for your solution ,
When i am testing it though as you can see is with 2 values outside of the test condition it still comes back as TRUE ?

Ideally what I am looking for is a formula that only returns a TRUE when all of the values in the table lie within the top and bottom limit values.
For example as long as the Values A1:E3 are <=0.95 (B7) and >=0.63 (B8) then the function should return a TRUE if any of the values are outside of the limits it should return as FALSE.

Is there something else I could try?
 
Upvote 0
You have the B8 & B7 the wrong way round in the formula.
 
Upvote 0
try
Book1
ABCDEF
20.810.750.890.750.781
30.770.650.790.740.886
40.880.80.770.880.89-5
5
60.96True
70.64True
8
9PassPassPassPassPassFail
10PassPassPassPassPassFail
11PassPassPassPassPassFail
Sheet1
Cell Formulas
RangeFormula
B6:B7B6=ISNUMBER(A6)
A9:F11A9=IF(AND(A2<=$A$6,A2>=$A$7),"Pass","Fail")
cap2.PNG

Thank you for your solution Also,
When i am testing it as you can see is with 2 values outside of the test condition your solution does Highlight the 2 that fall outside , which is along the lines i am looking for ?

Ideally what I am looking for is a formula that only returns a TRUE when ALL of the values in the table lie within the top and bottom limit values.
For example as long as the Values A1:E3 are <=0.95 (B7) and >=0.63 (B8) then the function should return a TRUE if any of the values are outside of the limits it should return as FALSE.

Is there something else I could try?
 
Upvote 0
You have the B8 & B7 the wrong way round in the formula.
cap5.PNG


HI,
I'm probably doing something wrong but, Have rearranged as per your reply.
When testing it with live Data again i still have a problem where it doesn't recognise that when the value has changed, as you can see from the image.
B2 is now 1.25 which is outside of the 1.03 Maximum yet still shows as true.

Any suggestions ?
 
Upvote 0
OOps, wasn't thinking.
How about
=OR(COUNTIF(A1:E3,">"&B7),COUNTIF(A1:E3,"<"&B8))
 
Upvote 0
OOps, wasn't thinking.
How about
=OR(COUNTIF(A1:E3,">"&B7),COUNTIF(A1:E3,"<"&B8))

Thanks ,
It's working, with a true and False I can code the conditional formatting I need for it to display correctly.
.
Thank You for your Patience.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,885
Messages
6,181,574
Members
453,055
Latest member
cope7895

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