Highlighting blank cells based on another value, but columns aren't always the same

nfunkhouser

New Member
Joined
Mar 25, 2025
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet where I'm looking to highlight the Network ID if they put YES in the Network Requested field - the issue I'm having is that the people who submit these to us like to move things around, so I don't always know if the Network ID will be in the same column - sometimes it's in I, sometimes H, sometimes they move it to the end and it's in column BA. It's a pain, but sending them back isn't an option. Is there a way to do this using either VBA or conditional formatting, when I don't know what the column letters will be?

What it looks like:
1742934026374.png



What I'd like it to do - highlight the blank Network ID since they put YES in Network Requested but didn't provide a Network ID
1742934062782.png
 
If I'm understanding correctly, this would require us to alter the formula each time we get a spreadsheet back, is that right?
I wouldn't have thought so. Doesn't the table already exist when you give the workbook out?
If so you could have the CF applied before you send it if all the users might be doing is reordering/adding/deleting columns.

However, if you would prefer a macro to run when you get the workbook back, I think all you should need is this.
That is assuming ..
  1. That is a formal Excel table as it appears to be in your original image.
  2. That table is the only (or first indexed) table on the worksheet.
  3. Columns "Network ID" and "Network Requested" columns appear somewhere in the table.
A possible advantage of this code is that if for some reason you edit values in "Network ID and/or "Network Requested" then any relevant yellow will appear/disappear without having to run the code again.

VBA Code:
Sub Highlight_Yes_Blank()
  Dim lo As Object
  
  Set lo = ActiveSheet.ListObjects(1)
  With lo.ListColumns("Network ID").DataBodyRange
    .FormatConditions.Delete
    .FormatConditions.Add xlExpression, , "=AND(" & .Cells(1).Address(0, 0) & "=""""," & "INDIRECT(""" & lo.Name & "[@Network Requested]"")=""Yes"")"
    .FormatConditions(1).Interior.Color = vbYellow
  End With
End Sub
 
Upvote 0

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