Conditional formatting for specific # entries

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,124
Office Version
  1. 365
Platform
  1. Windows
How do I use conditional formatting in excel to only accept the entries of ONLY the NUMBERS (1, 4, 5, 7, 8) and nothing else?

Where it highlights any CELL that is not one of these entries? (Except the blank!) So a COLUMN might have:

A1• 142425aasj
A2• 424252 asd
A3• asdasd 65566
A4• 1
A5• 4
A6• 5
A7• 7
A8• 8
A9•
A10• 21123123
A11• KJD33

Where it will highlight (A1, A2, A3, A10, A11), where it will not highlight (A4, A5, A6, A7, A8, A9).


I'm working with 'Data Validation' but I need a formula

in using ->

Conditional Formatting


Thank you.
 
In Conditional Formatting you can use this formula
=AND(A1<>"",ISNA(MATCH(A1,{1;4;5;7;8},0)))

Hope this helps

M.
 
Upvote 0
Hi,

I do appreciate the formula and have paste it into the tab 'New Formatting Rule' > 'Use a formula to determine which cells to format'

It is pop-ups with this:


You may not use reference operators (such as unions, intersections, and ranges) or array constants for Conditional Formatting criteria.





Is there any way your formula can be revised.


Thank you.
 
Upvote 0
oops...Sorry, i forgot that is not possible to use array constants in CF

As a workaround create a named range, say MyList, containing the allowed numbers

Then you can use this formula in CF
=AND(A1<>"",ISNA(MATCH(A1,MyList,0)))

M.
 
Upvote 0
Another option.

Excel Workbook
A
1142425aasj
2424252 asd
3asdasd 65566
41
54
65
77
88
9
1021123123
11KJD33
Sheet2 (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A11. / Formula is =ISERROR(FIND("|"&A1&"|","|1|4|5|7|8||"))Abc
 
Upvote 0
Hi for the List style approach, how do I make the box source BIGGER?

Right now it is very tiny, and I don't know why?
 
Upvote 0
HI,

This formula, works like a charm!


=ISERROR(FIND("|"&A1&"|","|1|4|5|7|8||"))


Many thanks!
 
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