Conditional Formatting highlight cell in range based on a separate range

charliew

Board Regular
Joined
Feb 20, 2018
Messages
71
Office Version
  1. 365
Platform
  1. Windows
Afternoon everyone...

I am having a right mare with my conditional formatting formula and i feel like I've tried every variation and I've given up now...

I have a list of master codes in one sheet "EWC List" I then input incoming loads in another sheet "Stock" if while i'm inputting the EWC code i make a typo i want it to highlight.

i'm using:

Excel Formula:
=AND(NOT(ISBLANK(O2)),ISNA(MATCH(O2,'Full EWC list & chapters'!A2:A839,0)))

I have set it to apply to the whole of column O but it will still only work on cell O2...I know i'm doing something wrong but i cant figure it out...

i've also tried

Excel Formula:
=AND(NOT(ISBLANK(O:O)),ISNA(MATCH(O2,'Full EWC list & chapters'!A2:A839,0)))

and

Excel Formula:
=AND(NOT(ISBLANK(O2)),ISNA(MATCH(O:O,'Full EWC list & chapters'!A2:A839,0)))

and

Excel Formula:
=AND(NOT(ISBLANK(O:O)),ISNA(MATCH(O:O,'Full EWC list & chapters'!A2:A839,0)))

Please help me

Thank you so much in advance!!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I think this might be it...
If the first cell in the formatting range is O2 - then I think this will work. You need $ in the match range, or that will increment too.

Excel Formula:
=AND(NOT(ISBLANK(O2)),ISNA(MATCH(O2,'Full EWC list & chapters'!$A$2:$A$839,0)))
 
Upvote 0
Solution
You could also check correct data entry with data validation (Data/Data Validation):

Lets say you have this list of Master codes in EWC list:
Book1
A
1Master codes
2ABC
3ABD
4ABE
5ABF
EWC List


And name the range MasterCodes.

Then you add data validation like this in the cell where you are going to enter the codes (create one and copy down, or if it is formatted as a table it will apply to the whole column):

1721410781640.png


You will get the desired data validation message, and you also have a dropdown list with values to choose from:

1721411016087.png


If you think this works for you and need help setting this up, let us know.
 
Upvote 0
Or you could try this formula: in your conditional formatting:

1721412273472.png


Excel Formula:
=(O2<>"")*NOT(ISNUMBER(MATCH(O2, 'EWC List'!$A$2:$A$839,0)))

And make sure that O2 is the same as the start of the range you applying the formatting to.
 
Upvote 0
Thank you so much for your time and help! i'm in front of my spreadsheet now, so i will try your suggestions.

thanks again!
 
Upvote 0
Wonderful thank you all!

Is there a way of highlighting if a format is incorrect?

For example the format NEEDS to be

XXXXXX/XXXXX

Can i get it to highlight if there are insufficient amount of characters either side of the /

thank you again!
 
Upvote 0
Lets assume that your range starts in A2, try this:
Excel Formula:
=LET(t,A2,(IFERROR(ISNUMBER(FIND("/",t))*(LEN(TEXTBEFORE(t,"/"))=6)*(LEN(TEXTAFTER(t,"/"))=5),0)=0)*(t<>""))
In your conditional formatting
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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