Sheetsdrill

Level 5: Text and dates Exercise 92 of 92

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,}$

Functions used: IF, REGEXMATCH

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 exercise

More exercises in Text and dates