Flag addresses that are not emails
A Google Sheets formula exercise from Sheetsdrill. Solve it with a formula bar on a live sheet in your browser, and it is checked the moment you submit.
The task
An address is accepted when it has text with no spaces, one @, more text, a dot and at least two lowercase letters at the end. Show "OK" for an accepted address and "Check" for the others. Fill B2 to B4 using REGEXMATCH.
What this exercise teaches
REGEXMATCH returns TRUE or FALSE, so it drops straight into IF. The anchors ^ and $ matter: without them a pattern only has to match part of the text, and almost anything with an @ would pass.
A hint if you get stuck
[^@\s]+ means one or more characters that are not an @ or a space. Put ^ at the start and $ at the end so the whole address has to fit: ^[^@\s]+@[^@\s]+\.[a-z]{2,}$
Try it now, free, no account needed
Your first 15 exercises on Sheetsdrill are free. Open it on the practice page, solve it, and get instant feedback with a hint. A free account adds the worked solution; Pro unlocks every exercise, timed mode and the certificate.
Open this exerciseMore exercises in Text and dates
- First name with SPLIT
- Join the confirmed names
- Address without gaps
- Valid order IDs
- Pull out the invoice number
- Digits only
- Month label with TEXT
- Full years of service
- Working days with holidays
- Due at the end of next month
- Tidy up pasted names
- Items in a comma list
- Domain of an email address
- Renewal date with EDATE
- Orders placed at the weekend
- Amount inside a sentence
- The part before the @
- Mask an account number
- Ship-by date in working days
- Day of the week as a word
- Days until the deadline