Automatic Highlighting of nearest values based on one manually highlighted cell's value

jsk123

New Member
Joined
Nov 4, 2017
Messages
6
Please take a look at this image.

r3CPtTI.png



This spreadsheet contains a separate continuous sequence of numbers. Each sequence is present in a separate column and is completely independent from the other sequences.
What I will do is... I will highlight a value in the first column in yellow.
What I want Excel to do is... It should highlight the cells values (in blue) in remaining columns that are closest to the cell's value I highlighted in yellow

For example, please take a look at the image...
I highlighted 217.3 in Column A in Yellow. Now, In the remaining columns, B,C,D and E, the cells with closest value to 217.3 must be highlighted in e.g. Blue by excel .

How to achieve this? I want this to be able to dynamically update the sheet when I remove the highlight or add new highlights...

Please guide me...
 
As MAIT said before, there is no event trigger that fires when you manually change the color of a cell. The same is true of Conditional Formatting. It can't "see" if a cell is highlighted or not. If you want to use CF only, with no VBA, the best suggestion I can offer would be to enter the value of interest in another cell, for example G1. Given your example above, you'd put 217.3 in G1. Then follow these steps:

1) Select column A
2) Click Conditional Formatting > New Rule > Use a Formula > and enter:
=AND(A1=$G$1,A1<>"")
3) Select a yellow fill color and click OK.

4) Select columns B:E
5) Click Condiational Formatting > New Rule > Use a Formula > and enter:
=AND(B1<>"",ABS(B1-$G$1)=MIN(ABS(B$1:B$100-$G$1)))
6) Select a blue fill color and click OK.

The 100 in the formula refers to the bottom row of your data, just pick something equal to or below the last line of data, but not too huge since it will affect performance.

Now when you change G1 the colors will change to match. If this is not workable for you, then I can talk you through the other option I mentioned. This would be a VBA event handler where you would double click a cell in column A, and it would highlight the matching cells for you. But these are about the only 2 methods I can think of.

Let us know if this works for you.
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Thank you so much @EricW :) I like this solution.... Added a few customizations and it is ok ok... good enough to get the job done...
 
Upvote 0

Forum statistics

Threads
1,216,011
Messages
6,128,265
Members
449,436
Latest member
blaineSpartan

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