highlight cells with a value within 3 of other cells on the row

cspgsl

Board Regular
Joined
Oct 22, 2002
Messages
65
I am no Excel expert so I am looking to see if this is possible.

I have a table like you see here. On each row, I want to conditionally highlight any two cells in the Daily Yardage columns with the same colour if the values are within 3 of any other cell in any other Daily Yardage column within the same row.

In other words, I want to compare the values in G6, M6, S6, Y6 and AE6 and if any values are within 3 of another, change the colour on the two cells that are within 3.

I have manually done it here but the table is actually 31 rows (for a month) and I am trying different scenarios in each of the Tee and Hole columns.

Any help would be appreciated.
Thanks

excel.png
 
When you apply the conditional formatting, the rule is applied relative to the activecell, in your screen capture above, I can't see that G6 is active, which potentially means that everything is out of alignment.

Try a different method.

Delete the rule, then create a new one applied only to G6 (single cell) using the correct formula from my earlier post.

Click the OK buttons until the editor closes, then, witihout moving away from G6, go in to edit the rule and then copy and paste the range to apply to from your post above.

Does that fix it?
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I don't know if this is allowed, but I can send you the file if you wanted to try it.
 
Upvote 0
I see it is catching some of the combinations but it is also highlighting cells that do not fall into the criteria
right n wrong.png
 
Upvote 0
I don't know if this is allowed, but I can send you the file if you wanted to try it.
Normal practice is to post a link to your file on a site like dropbox after removing or fictionalising any confidential data.
 
Upvote 0
The problem is that you have a line break in the header column. Try
=COUNTIFS($G$4:$AE$4,"Daily"&CHAR(10)&"Yardage",$G6:$AE6,">="&(G6-3),$G6:$AE6,"<="&(G6+3))>1
 
Upvote 0
Thanks for the reply Fluff.

I applied the change but the results only highlight the last column, AE, and then, it doesn't highlight the two cells that are within 3 of each other. You can see by the circles here. Also, row 15 shows AE 15 as highlighted where there are no qualifying cells.

fluff 1.png
 
Upvote 0
This is what I get

Yardages.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAE
1Par 3 Tee & Hole Placement StandardsShaded area = < 3 yards difference when compared to other tees of the day
2
347121417
4TeeTo CenterHoleFrom CenterDaily YardageTeeTo CenterHoleFrom CenterDaily YardageTeeTo CenterHoleFrom CenterDaily YardageTeeTo CenterHoleFrom CenterDaily YardageTeeTo CenterHoleFrom CenterDaily Yardage
5PIN
61MondayA160316176A1651-16149A1781-16162A20020200A151316167
72TuesdayB18020180B175316191B17020170B195316211B1601-16144
83WednesdayC1531-16137C17020170C158316174C1901-16174C14220142
91ThursdayD173316189D1561-16140D1851-16169D23220232D172316188
102FridayA16020160A165316181A17820178A200316216A1511-16135
113SaturdayB1801-16164B17520175B170316186B1951-16179B16020160
121SundayC153316169C1701-16154C1581-16142C19020190C142316158
132MondayD17320173D156316172D18520185D232316248D1721-16156
143TuesdayA1601-16144A16520165A178316194A2001-16184A15120151
151WednesdayB180316196B1751-16159B1701-16154B19520195B160316176
162ThursdayC15320153C170316186C15820158C190316206C1421-16126
173FridayD1731-16157D15620156D185316201D2321-16216D17220172
181SaturdayA160316176A1651-16149A1781-16162A20020200A151316167
192SundayB18020180B175316191B17020170B195316211B1601-16144
203MondayC1531-16137C17020170C158316174C1901-16174C14220142
211TuesdayD173316189D1561-16140D1851-16169D23220232D172316188
222WednesdayA16020160A165316181A17820178A200316216A1511-16135
233ThursdayB1801-16164B17520175B170316186B1951-16179B16020160
241FridayC153316169C1701-16154C1581-16142C19020190C142316158
252SaturdayD17320173D156316172D18520185D232316248D1721-16156
263SundayA1601-16144A16520165A178316194A2001-16184A15120151
271MondayB180316196B1751-16159B1701-16154B19520195B160316176
282TuesdayC15320153C170316186C15820158C190316206C1421-16126
293WednesdayD1731-16157D15620156D185316201D2321-16216D17220172
301ThursdayA160316176A1651-16149A1781-16162A20020200A151316167
312FridayB18020180B175316191B17020170B195316211B1601-16144
323SaturdayC1531-16137C17020170C158316174C1901-16174C14220142
331SundayD173316189D1561-16140D1851-16169D23220232D172316188
342MondayA16020160A165316181A17820178A200316216A1511-16135
353TuesdayB1801-16164B17520175B170316186B1951-16179B16020160
361WednesdayC153316169C1701-16154C1581-16142C19020190C142316158
Yardages
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G6:G36,M6:M36,S6:S36,Y6:Y36,AE6:AE36Expression=COUNTIFS($G$4:$AE$4,"Daily"&CHAR(10)&"Yardage",$G6:$AE6,">="&(G6-3),$G6:$AE6,"<="&(G6+3))>1textNO


Check that you have applied it to the correct area.
 
Last edited by a moderator:
Upvote 0
hmmm... somehow, the following crept into the formula

=COUNTIFS($G$4:$AE$4,"Daily"&CHAR(10)&"Yardage",$G6:$AE6,">="&(XEM6-3),$G6:$AE6,"<="&(XEM6+3))>1
 
Upvote 0

Forum statistics

Threads
1,214,986
Messages
6,122,611
Members
449,090
Latest member
vivek chauhan

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