Highlight Cell Based on Value of Another Cell

PartsPig

New Member
Joined
Sep 13, 2024
Messages
49
Office Version
  1. 365
Platform
  1. Windows
This may require VBA.
I have a formula in a cell that is working as desired to return TRUE when I want another cell in the same row to be highlighted by filling it with purple however I cannot figure out how to get conditional formatting to do this. The formula in said cell is the AND statement below that has 3 conditions to be met. I have the 3 conditions separated below for ease of reading and I have no idea how condition 2 works I just know it does. I'm sure there must be a better way to do this but this is where I am thus far.

The 3 conditions defined:
1 Confirm it is not a formula therefore it has been typed over by something
2 Confirm it it only letters and spaces with nothing else therefore confirming this is the first time this customer's name has been added to the spreadsheet (could have / in it which would be valid but not the first time this customer's name was added)
3 Confirm the value is not equal to void which would satisfy condition 2 but is a valid value that doesn't meet the conditions desired

=AND
(
NOT(ISFORMULA(Table2[@Customer])),
IF(ISNUMBER(SUMPRODUCT(SEARCH(MID(Table2[@Customer],ROW(INDIRECT("1:"&LEN(Table2[@Customer]))),1)," abcdefghijklmnopqrstuvwxyz"))),"true","false"),
Table2[@Customer]<>"void"
)

Like I said, the current form of the formula is working as desired and is not the focus of this question but any and all advice to make the formula easier to follow (especially condition 2) would be appreciated. Ultimately I would like to remove the formula from the spreadsheet altogether and have it either in a conditional format rule or in VBA.
 
The second part of your formula splits out the individual characters in [@Customer] and checks they each match the a-z or space characters (And as Search is not case-sensitive, A-Z will also be OK).

Do you have the new REGEX functions? If so, you could use:

Excel Formula:
=LET(c,[@Customer],AND(NOT(ISFORMULA(c)),REGEXTEST(c,"^[a-zA-Z ]*$"),c<>"void"))

Or in a conditional formatting formula:

Excel Formula:
=LET(c,INDIRECT("Table2[@Customer]"),AND(NOT(ISFORMULA(c)),REGEXTEST(c,"^[a-zA-Z ]*$"),c<>"void"))
 
Upvote 0
The second part of your formula splits out the individual characters in [@Customer] and checks they each match the a-z or space characters (And as Search is not case-sensitive, A-Z will also be OK).

Do you have the new REGEX functions? If so, you could use:

Excel Formula:
=LET(c,[@Customer],AND(NOT(ISFORMULA(c)),REGEXTEST(c,"^[a-zA-Z ]*$"),c<>"void"))

Or in a conditional formatting formula:

Excel Formula:
=LET(c,INDIRECT("Table2[@Customer]"),AND(NOT(ISFORMULA(c)),REGEXTEST(c,"^[a-zA-Z ]*$"),c<>"void"))
That worked perfectly and greatly decreases the confusion when looking at the formula. Thanks for the tip!!!

Unfortunately I can't seem to get it to work in conditional formatting...
Ultimately I would want it to change the format of at least 2 different cells in the same row, E and G and maybe H(undecided).
 

Attachments

  • Identify New Customer Logic.PNG
    Identify New Customer Logic.PNG
    67.8 KB · Views: 7
Upvote 0
You need to use "Use a formula to determine..." ie the last option on the screen you showed.
 
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