Highlighting nearest date

Ian1976

Board Regular
Joined
Feb 4, 2016
Messages
137
Office Version
  1. 365
Platform
  1. Windows
Hi I have a table which holds dates (G17:G23) is there anyway of highlighting the nearest date in the corresponding row to the date shown in column G?

Thank you, its part of a much bigger spreadsheet or I'd do it manually! :)

28/09/202123/07/202117/09/202112/11/202107/01/202204/03/2022
21/07/202103/07/202128/08/202123/10/202118/12/202112/02/2022
04/07/202111/07/202105/09/202131/10/202126/12/202120/02/2022
22/08/202102/07/202127/08/202122/10/202117/12/202111/02/2022
15/10/202129/07/202123/09/202118/11/202113/01/202210/03/2022
14/07/202122/07/202116/09/202111/11/202106/01/202203/03/2022
20/07/202109/07/202103/09/202129/10/202124/12/202118/02/2022
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also which of those columns is col G?
 
Upvote 0
CF for A1:

=MIN(ABS($A1:$F1-$G1))=ABS(A1-$G1)

set colour or whatever you want then apply this CF into A1:G7

p.s. I am not sure that I understand correctly because in you example always date from F is nearest, coincidence?
 
Upvote 0
Assuming that the first col is col G, how about
+Fluff 1.xlsm
GHIJKLM
1728/09/202123/07/202117/09/202112/11/202107/01/202204/03/2022
1821/07/202103/07/202128/08/202123/10/202118/12/202112/02/2022
1904/07/202111/07/202105/09/202131/10/202126/12/202120/02/2022
2022/08/202102/07/202127/08/202122/10/202117/12/202111/02/2022
2115/10/202129/07/202123/09/202118/11/202113/01/202210/03/2022
2214/07/202122/07/202116/09/202111/11/202106/01/202203/03/2022
2320/07/202109/07/202103/09/202129/10/202124/12/202118/02/2022
Lists
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I17:M23Expression=ABS($G17-I17)=MIN(ABS($I17:$M17-$G17))textNO
 
Upvote 0
Solution
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also which of those columns is col G?

Hi Fluff,

Sorry details updated and column G is the 1st column of the table!

Thanks
 
Upvote 0
Thanks for that. Have a look at post#4
 
Upvote 0
That's effect of insufficient details :)
 
Upvote 0
hi Fluff,

Working great, but one question....

When I use these dates I'm getting 2 cells highlighted??

The 09/09/21 & 04/11/21 highlight.

Thanks again! :)

@KOKOSEK Thanks for the help, I kind of threw you a curve ball! :(

07/10/202115/07/202109/09/202104/11/202130/12/202124/02/202221/04/202216/06/2022
 
Upvote 0

Forum statistics

Threads
1,215,872
Messages
6,127,430
Members
449,382
Latest member
DonnaRisso

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