Hi all,
Happy Friday!
How can you write a formula that will test if a cell
begins with x, y, or z?
As always in Excel, there are different ways to approach this problem. I think the simplest way is to use the OR function with the LEFT function to perform the test. Then use the IF function to return a final result.
You can see this approach below, where the formula in cell D5 is:
=IF(OR(LEFT(B5,1)={"x","y","z"}),"x","")
[
Download the workbook and read the full explanation]
You might be curious about the {"x","y","z"} in the formula. That's called an "array constant," and it's a clever way to simplify the formula. The article above explains this idea in more detail. Click the link to download the workbook and give it a whirl yourself!
Excel formulas
The secret to mastering Excel formulas? Practice, practice, practice!
We've put together a list of over 500 working formulas
right here for you to explore.
If you prefer a more structured approach, we've got you covered with
video training. Each video is short (about 3 minutes) and provides a practice worksheet.
Have a great weekend!
Dave