Highlight cell if text matches in range of cells, but only if other cells are blank

SaraWitch

Active Member
Joined
Sep 29, 2015
Messages
370
Office Version
  1. 365
Platform
  1. Windows
Hello peeps,

I have a range of cells that contain addresses with start and end dates. I want to highlight a cell if a new address is entered which is already 'active' elsewhere on the sheet; i.e., address is elsewhere and hasn't got an end date. I'm tying myself up in knots a bit!
¦ MrExcel Queries.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXY
1Address 1Should beLocationDate fromDate toAddress 2LocationDate fromDate toAddress 3LocationDate fromDate toAddress 4LocationDate fromDate toAddress 5LocationDate fromDate toAddress 6LocationDate fromDate to
2Gnome Cave, High Cloud East Sun25/08/202207/08/2022Sky Apartments, Stormville East Sun08/08/202205/01/2022Low Heaven, Angel Cove East Sun06/01/202209/10/2023Ocean Whirlpool, Seagate East Sun10/10/202310/11/2023Valley Deep, Grasslands East Sun11/11/202301/01/2024Forest Mound, Woodland 02/01/202403/01/2024
3Gnome Cave, High Cloud East Sun25/08/202207/08/2022Sky Apartments, Stormville East Sun08/08/202205/01/2022Low Heaven, Angel Cove East Sun06/01/202209/10/2023Ocean Whirlpool, Seagate East Sun10/10/202310/11/2023Valley Deep, Grasslands East Sun11/11/2023
4Gnome Cave, High Cloud Gnome Cave, High Cloud East Sun25/08/2022Sky Apartments, Stormville East Sun08/08/202205/01/2022Low Heaven, Angel Cove East Sun06/01/2022Ocean Whirlpool, Seagate East Sun10/10/202310/11/2023East Sun
5Gnome Cave, High Cloud Gnome Cave, High Cloud
6Sky Apartments, StormvilleSky Apartments, Stormville
7Low Heaven, Angel Cove Low Heaven, Angel Cove
8Ocean Whirlpool, Seagate Ocean Whirlpool, Seagate
9Valley Deep, Grasslands Valley Deep, Grasslands
10Forest Mound, Woodland Forest Mound, Woodland
CF Active Same
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B9Expression=AND(ISNUMBER(MATCH(B9,B9:B17,0)),ISBLANK(F9:F17))textNO
B7Expression=AND(ISNUMBER(MATCH(B7,B7:B15,0)),ISBLANK(F7:F15))textNO
B4Expression=AND(ISNUMBER(MATCH(B4,B4:B12,0)),ISBLANK(F4:F12))textNO
B5,A2:A10Expression=AND(ISNUMBER(MATCH(A2,A2:A10,0)),ISBLANK(E2:E10))textNO
V2:V10Expression=AND(ISNUMBER(MATCH(V2,V2:V10,0)),ISBLANK(Y2:Y10))textNO
F2:F10,J2:J10,N2:N10,R2:R10Expression=AND(ISNUMBER(MATCH(F2,F2:F10,0)),ISBLANK(I2:I10))textNO

Any help would be appreciated :)
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
What is your should be column?
Are you entering only in column A or anywhere?

Explain a little more about the use case.
 
Upvote 0
Any new address could be entered anywhere in the range A2:Y10. However, if that address is active anywhere else in the same range (i.e., it has been entered elsewhere but has no end date ("Date to" in columns E, I, M, Q, U, Y)), then change both cells red.

The "Should be" column in my example is the colour I would like the cell to be (with B4 also being red).

Apologies, and hope this makes it a little clearer.
 
Upvote 0
Here's more example data, if it helps:
¦ MrExcel Queries.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1Address 1Should beLocationDate fromDate toAddress 2Should beLocationDate fromDate toAddress 3LocationDate fromDate toAddress 4LocationDate fromDate toAddress 5LocationDate fromDate toAddress 6LocationDate fromDate to
2Gnome Cave, High Cloud East Sun25/08/202207/08/2022Sky Apartments, Stormville East Sun08/08/202205/01/2022Low Heaven, Angel Cove East Sun06/01/202209/10/2023Ocean Whirlpool, Seagate East Sun10/10/202310/11/2023Valley Deep, Grasslands East Sun11/11/202301/01/2024Forest Mound, Woodland 02/01/202403/01/2024
3Gnome Cave, High Cloud East Sun25/08/202207/08/2022Sky Apartments, Stormville East Sun08/08/2022Low Heaven, Angel Cove East Sun06/01/202209/10/2023Ocean Whirlpool, Seagate East Sun10/10/202310/11/2023Valley Deep, Grasslands East Sun11/11/2023
4Gnome Cave, High Cloud Gnome Cave, High Cloud East Sun25/08/2022Sky Apartments, Stormville Sky Apartments, Stormville East SunLow Heaven, Angel Cove East Sun06/01/2022Ocean Whirlpool, Seagate East Sun10/10/202310/11/2023
5Gnome Cave, High Cloud Gnome Cave, High Cloud Forest Mound, WoodlandForest Mound Woodland
6Sky Apartments, StormvilleSky Apartments, Stormville
7Low Heaven, Angel Cove Low Heaven, Angel Cove
8Ocean Whirlpool, Seagate Ocean Whirlpool, Seagate
9Valley Deep, Grasslands Valley Deep, Grasslands
10
CF Active Same
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A10,F2:F10Expression=AND(ISNUMBER(MATCH(A2,A2:A10,0)),ISBLANK(E2:E10))textNO
W2:W10Expression=AND(ISNUMBER(MATCH(W2,W2:W10,0)),ISBLANK(Z2:Z10))textNO
K2:K10,O2:O10,S2:S10Expression=AND(ISNUMBER(MATCH(K2,K2:K10,0)),ISBLANK(N2:N10))textNO
 
Upvote 0
I'm not sure how many addresses you have to the right.

Anyway to store the data this way?
Can you use a simple macro to loop through used range of cells and check?

Book1
ABCDE
1Address #AddressLocationDate fromDate to
21Gnome Cave, High Cloud East Sun8/25/20228/7/2022
32Gnome Cave, High Cloud East Sun8/25/20228/7/2022
43Gnome Cave, High Cloud East Sun8/25/2022
54Gnome Cave, High Cloud
61Sky Apartments, Stormville
71Low Heaven, Angel Cove
81Ocean Whirlpool, Seagate
91Valley Deep, Grasslands
Sheet3
 
Upvote 0
Thank you, @*skillilea. There are six addresses (you should be able to scroll across to column Z in the examples).

I'm not quite sure what you mean by using a simple macro to loop through. :unsure:

I want a cell to change colour if the address being entered is already active elsewhere in the sheet (i.e., if the address is elsewhere and it does not have a date entered in the 'Date to' column immediately after). If the address is elsewhere in the sheet and does have a date entered in the 'Date to' column, then the cell does not need to change colour. And the rows cannot be moved around (they need to stay in the same order as in my examples).

Not sure it can be done...?
 
Upvote 0
Are you only entering in Address1 or can you enter in any of the address columns?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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