How to conditionally format a table to highlight cells based on a list of coordinates that you enter?

jennuine

New Member
Joined
Jun 30, 2023
Messages
2
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I wracked my brain over this one and I'm honestly not sure how to proceed but I'm willing to learn and work this through. If you can point me in a direction I would be immensely grateful.

Problem: I have a seating plan where the row and column together give me the position of a participant's table. As I enter the data on the right table ("Participants' Tables"), the left table ("Seating Map") should highlight the cell that has the same value. For example, if I enter "A58" under column Table on the right, the cell that is in column "A" with the value 58 should be highlighted orange (cell A9). Is there a way I can ask Excel to do this for me automatically instead of my having to manually search and highlight the position of the table? Thank you for your help in advance. 🙇‍♂️

1688109793155.png

1688109821818.png



SEATING PLAN.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1SEATING MAPPARTICIPANTS' TABLES
2
3ABCDEFGHIJKLPARTICIPANTSTABLE
46262626262Person 1A58
5616161616161Person 2G45
66060606060606060606060Person 3K56
7595959595959595959595959
8585858585858585858585858
9575757575757575757575757
10565656565656
11555555555555555555555555
12545454545454545454545454
13535353535353535353535353
14525252525252525252525252
155151515151
16505050505050505050505050
17494949494949494949494949
18484848484848484848484848
19474747474747474747474747
20464646464646
21454645454545454545454545
22444444444444444444444444
23434343434343434343434343
2442424242424242424242
25
26414141414141
27404040404040
28393939393939393939393939
29383838383838383838383838
30373737373737373737373737
31363636363636363636363636
32353535353535
33343434343434343434343434
34333333333333333333333333
35323232323232323232323232
36313131313131313131313131
37303030303030
38292929292929292929292929
39282828282828282828282828
40272727272727272727272727
41262626262626262626262626
42
4324
4423
4522
46212121212121
47202020202020
48191919191919191919191919
49181818181818181818181818
50171717171717171717171717
51161616161616161616161616
521515151515
53141414141414141414141414
54131313131313131313131313
55121212121212121212121212
56111111111111111111111111
57101010101010
58090909090909090909090909
59080808080808080808080808
60070707070707070707
6106060606060606
6205050505
63040404040404040404
64030303030303030303
65020202020202020202
66010101010101010101
TEMP
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A4:R66Expression=IFtextNO
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Kindly give a shot @jennuine

Right click sheet1 -> view code -> paste below code then run the code by pressing F5

the code will let you choose either yes or no
Yes: start formatting, If not found will give you notification and put red background color in AE exact Row
No: The code will only Clear/Reset background color

Unsure if using formula, this one probably can be your reference :)

1688114475646.png


VBA Code:
Option Explicit
Sub test()
Dim ws As Worksheet
Set ws = Sheets("sheet1")
Dim c As Range
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")
dict.Comparemode = vbTextCompare
Dim answer As Integer
Dim i As Integer
Dim a As Variant
Dim ss As Range

answer = MsgBox("Do you want update color", vbQuestion + vbYesNo + vbDefaultButton2, "Format Table")

If answer = vbNo Then
  ws.[a4:r20000].Interior.Color = RGB(245, 252, 255)
  ws.[ae4:ae20000].Interior.Color = RGB(245, 252, 255)
  Exit Sub
End If

With ws
.[a1].UnMerge
.[a4:r20000].Interior.Color = RGB(245, 252, 255)
a = .Range("ad4:Ae" & .Cells(Rows.Count, "ae").End(xlUp).Row).Value 'AD AE Values store in array
End With

For Each ss In Range("a3:r3") 'Store Dict from range a3 to r3
    If ss.Value <> "" Then
        dict.Add ss.Value, ss.Column
    End If
Next ss

For i = 1 To UBound(a, 1)
    If dict.exists(a(i, 1)) Then
        Set c = Columns(dict(a(i, 1))).Find(what:=a(i, 2), LookIn:=xlValues)
      
        If c Is Nothing Then
            MsgBox a(i, 1) & " " & a(i, 2) & "cant be found"
            Cells(i + 3, "AE").Interior.Color = vbRed
        Else
            c.Interior.Color = RGB(255, 192, 0)
        End If
  
    End If
Next i

End Sub
 
Last edited:
Upvote 1
or using conditional formatting

=COUNTIFS($AD$4:$AD$41,A$3,$AE$4:$AE$41,A4)>0

for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
$A$4:$R$66 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=COUNTIFS($AD$4:$AD$41,A$3,$AE$4:$AE$41,A4)>0

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK

Book2
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1SEATING MAPPARTICIPANTS' TABLES
2
3ABCDEFGHIJKLPARTICIPANTSTABLE
46262626262Person 1A58
5616161616161Person 2g45
66060606060606060606060Person 3c62
7595959595959595959595959P4k56
8585858585858585858585858
9575757575757575757575757
10565656565656
11555555555555555555555555
12545454545454545454545454
13535353535353535353535353
14525252525252525252525252
155151515151
16505050505050505050505050
17494949494949494949494949
18484848484848484848484848
19474747474747474747474747
20464646464646
21454645454545454545454545
22444444444444444444444444
23434343434343434343434343
2442424242424242424242
25
26414141414141
27404040404040
28393939393939393939393939
29383838383838383838383838
30373737373737373737373737
31363636363636363636363636
32353535353535
33343434343434343434343434
34333333333333333333333333
35323232323232323232323232
36313131313131313131313131
37303030303030
38292929292929292929292929
39282828282828282828282828
40272727272727272727272727
41262626262626262626262626
42
4324
4423
4522
46212121212121
47202020202020
48191919191919191919191919
49181818181818181818181818
50171717171717171717171717
51161616161616161616161616
521515151515
53141414141414141414141414
54131313131313131313131313
55121212121212121212121212
56111111111111111111111111
57101010101010
58999999999999
59888888888888
60777777777
616666666
625555
63444444444
64333333333
65222222222
66111111111
67
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A4:R66Expression=COUNTIFS($AD$4:$AD$41,A$3,$AE$4:$AE$41,A4)>0textNO
 
Upvote 1
Solution
FYR: For A1 Seating Map,

It would be good to unmerge cell, Perhaps you can select from a1 to r1 then go to format cells, change it into center across selection.

Using Merge Cells are definitely not flexible to work with, CMIIW @jennuine

1688114704887.png
 
Upvote 1
Another possible Conditional formatting option

23 06 30.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1SEATING MAPPARTICIPANTS' TABLES
2
3ABCDEFGHIJKLPARTICIPANTSTABLE
46262626262Person 1A58
5616161616161Person 2G45
66060606060606060606060Person 3K56
7595959595959595959595959
8585858585858585858585858
9575757575757575757575757
10565656565656
11555555555555555555555555
12545454545454545454545454
13535353535353535353535353
14525252525252525252525252
155151515151
16505050505050505050505050
17494949494949494949494949
18484848484848484848484848
19474747474747474747474747
20464646464646
21454645454545454545454545
22444444444444444444444444
23434343434343434343434343
2442424242424242424242
25
26414141414141
Seating
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A4:R66Expression=AND(A4<>"",MATCH(A$3&A4,$AD$4:$AD$999&$AE$4:$AE$999,0))textNO
 
Upvote 1
Hello everyone,

The COUNTIFS conditional formatting worked!! Thank you very much for all your help!
 
Upvote 0
Glad you got something that worked. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,217
Members
449,091
Latest member
jeremy_bp001

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