As is often the case in Excel, there are multiple ways to approach this problem.
The simplest way is to use the OR function with the LEFT function to create the required logical test.
Another option is to use the COUNTIF function.
Both approaches are explained below.
Note: this formula is more advanced because we need to test for “cell begins with”.
For a more basic example of “cell equals this or that"see this pageorthis video.
OR + LEFT
TheOR functionreturns TRUE if any argument is TRUE.
It works like a range in Excel, except the values in an array constant are hard coded.
Putting this all altogether, we can use the formula above inside the IF function as the logical test.
However, you’ve got the option to also use a normal range on the worksheet.
To test more than one character, adjust num_chars as needed.
If no cells meet the criteria, COUNTIF returns zero.
The first count (0) is the count for cells that begin with “x”.
The second count (0) is for cells that begin with “y”.
The third count (1) is for cells that begin with “z”.
To check this, we add up all items using the SUM function.
Excel will automatically evaluate any number as TRUE and zero (0) as FALSE.
However, if the result from SUMis zero, IF will return an empty string ("").
OR returns TRUEif any condition is TRUE.
If all conditions are FALSE, the OR function returns FALSE.
For example, =LEFT(“apple”,3) returns “app”.
More than one condition can be tested by nesting IF functions.