Conditional Format for a number

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I would like to have a 10 digit number that only includes numbers. The formula that I'm currently using will flag anything over and under 10 digits. However, it will not flag anything other than a number like text or a space. Because what this document is used for I don't want to use data validation for this project. The formula I'm currently using is =AND(ISNUMBER(--C2),LEN(C2)<>10). I'm using the not equal because if this is filled out in error I need it highlighted. Also not critical but if I can have the 10 digit number lead off with a 1, it would be fantastic.

Thank you,
Sheridan
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I don't mean to get carried away, this particular one is a little annoying. I'm trying to avoid multiple rules in conditioning formatting if possible.
I think I would use something like =SUMPRODUCT(--ISNUMBER(SEARCH(Dairy,$A2))), but I would need to use that multiple times. Any idea how to put them all in one formula?
 

Attachments

  • name Ranges.JPG
    name Ranges.JPG
    47.7 KB · Views: 3
Upvote 0
I would think this more direct formula would also work...

=OR(C2<1000000000,C2>1999999999)
 
Upvote 0
Livin404, I'm a little confused as to what you want. Do you want to highlight the rows in column B where the food type in column A doesn't match the lists from sheet2? If so, why is Cheese highlighted? If not, please explain what your reasoning is for the Conditional Highlighting.


Rick, spot on! I didn't recognize offhand that would also handle non-numeric values.
 
Upvote 0
Livin404, I'm a little confused as to what you want. Do you want to highlight the rows in column B where the food type in column A doesn't match the lists from sheet2? If so, why is Cheese highlighted? If not, please explain what your reasoning is for the Conditional Highlighting.


Rick, spot on! I didn't recognize offhand that would also handle non-numeric values.
Hi yes the ones in that Column would be highlighted. Yes if they're are not equal to what is on sheet 2 they would get highlighted.
 
Upvote 0
Maybe something like this?

Book1 (version 1).xlsb
ABCDEFGHI
1Food TypeGroupFood TypeVegetablesStarchesFruitDairy
2SPastaVpeasPotatoAppleYogurt
3SPastaScornPastaPearCottage Cheese
4SPastaFBroccoliRiceBananaCheese
5SKaleDKaleBeansOrangeMilk
6FPlumCauliflowerCerealPlum
7FYamyamPeach
8DCheese
9DCheese
Sheet4
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B9Expression=ISERROR(MATCH(B2,CHOOSE(SEARCH(A2,"VSFD"),Vegetables,Starches,Fruit,Dairy),0))textNO
 
Upvote 0
That is beautiful and spot on. In the states and if I were a hunter I would say that is a 12 Point Buck, very impressive.
I have something kind of similar, but I'm sure it's a much easier formula. I have one formula that works, but it does the opposite of what I need. I have one column where I would enter a two letter country code in. It's not dependent on another cell. I'm am also using a data range called COUNTRY. I'm using =SUMPRODUCT(--ISNUMBER(SEARCH(COUNTRY,$S2))) which I can highlight if the information is correct. I'm trying to reverse it. I thought about putting an IFERROR formula but i can't figure out the syntax. I just recently trimmed around the formula you just provided to no avail.
 
Upvote 0
I'd think MATCH would work better than SUMPRODUCT(ISNUMBER(SEARCH. Try:

=ISERROR(MATCH(S2,COUNTRY,0))

If S2 isn't found in COUNTRY, it should highlight. Is the COUNTRY range just a list of the 2-digit codes? Or is it looking for "CA" in "CANADA"? I'd think that would cause a problem with "CAMBODIA" though.
 
Upvote 0

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

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