Return Closest Value

JWGoldfinch

Board Regular
Joined
Dec 23, 2009
Messages
50
I have a worksheet with data from A1 to F50, and there could be duplicate values, is there a formula that I can use in "Conditional Formatting" that would highlight the cells that are the closest to the value I enter into another cell without going over. Example if I enter 50 I would like to highlight the values in the range A1-F50 that are within a range of 45-50.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Not a formula, but if the number is entered in A52, then put

=A1-$A$52 in cell A54. Copy A54 to B54:f54, then copy A54:f54 to A55:F103.

The result will have the difference between your number and the data in the worksheet. Conditionaly Format A54:F103 to highlight any numbers that are from -5 to +5 to find any number that are within 5 of your target number, or however close you want to find.
 
Upvote 0
I have a worksheet with data from A1 to F50, and there could be duplicate values, is there a formula that I can use in "Conditional Formatting" that would highlight the cells that are the closest to the value I enter into another cell without going over. Example if I enter 50 I would like to highlight the values in the range A1-F50 that are within a range of 45-50.

G1: 50

Select A1:F50.
Activate Conditional Formatting.
Invoke the following formula:

=AND(A1>=$G$1-5,A1<=$G$1-5)

And choose the appropriate format.


Is this what you intended to do?
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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