Conditional formatting

JohnnySmith11

New Member
Joined
Feb 5, 2021
Messages
7
Office Version
  1. 365
Platform
  1. MacOS
Hi everyone!
I have a list of email addresses in column A.

A valid address is one that meets all the following conditions:
1. Has the sign "@".
2. At least 2 characters before the sign "@".
3. No spaces.
4. Has at least one dot "."

If the address is valid – it will be shown in blue color.
If the address is not valid – it will be shown in bold red color.

I am so lost. Could anyone please help?

Thanks so much in advance
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
you can use 4 helper-cells to make the conditions with: IF - SEARCH - TRUE - FALSE
Then you can combine these cells in one formula with: IF - AND - TRUE - FALSE
 
Upvote 0
Try:

Book1.xlsm
A
1jwnef@fawe.com
2f@fff.com
3erewre
4grge@.com
5howaboutthis@yahoo.com
6what about this@google.com
712@3.
812@3.4
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A:AExpression=AND(MATCH("*??@*?.?*",$A1,0),ISERROR(FIND(" ",A1)),$A1<>"")textNO
A:AExpression=OR(AND(ISERROR(MATCH("*??@*?.?*",$A1,0)),$A1<>""),NOT(ISERROR(FIND(" ",A1))))textNO
 
Last edited:
Upvote 0
Thank you so much! For some reason, this shows as blue even though it does not have at least two characters before the @.

Screen Shot 2021-02-05 at 11.28.57 AM.png
 
Upvote 0
There could be non-breaking space in there, looks like a space but is actually a different character. A rather common problem when you copypasta web page data into Excel.
Consider removing those characters first.
 
Upvote 0
try this (excel will naturally format valid email address in Blue):

1612517793928.png


Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A10Expression=IFERROR(AND(ISERROR(FIND(" ",A2)),FIND("@",$A2)>2,FIND(".",RIGHT($A2,LEN($A2)-FIND("@",$A2)))>0)*1,0)=0textNO
 
Upvote 0
This is what I originally did just using the suggested Excel conditional formatting options:
Also, do you think it's a must to use a custom function like you did above (as opposed to what I did here)?
The one thing I did not manage to achieve using my method was the "at least two characters before the @" rule...

Screen Shot 2021-02-05 at 11.34.32 AM.png

Screen Shot 2021-02-05 at 11.34.38 AM.png
 
Upvote 0
simple answer is I (almost) always use custom format conditions as they're so much more powerful. But in the right place the built in functions are brilliant.
 
Upvote 0
simple answer is I (almost) always use custom format conditions as they're so much more powerful. But in the right place the built in functions are brilliant.
I understand... And what simple function would you do just for this rule "At least 2 characters before the sign @"? How do I make an if that does that?
 
Upvote 0
Post #3 already covers that, using match to look for 2 characters before "@".

Post #5 suggests why you still bump into the problem you mentioned in post #4.
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

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