To check whether a cell starts with specific text, compare the first characters with LEFT: =IF(LEFT(A2,3)="LXI","Yes","No") tests the first three. The number in LEFT must match the length of the text you’re testing for.
This comparison is not case-sensitive, so “lxi” also returns Yes — use =IF(EXACT(LEFT(A2,3),"LXI"),"Yes","No") when case matters. To check whether a cell starts with a number, test just the first character: =IF(ISNUMBER(VALUE(LEFT(A2,1))),"Yes","No").
To count how many cells start with something, COUNTIF with a trailing wildcard is simpler than an array formula: =COUNTIF(A2:A10,"LXI*"). And to take the text from a cell rather than typing it in, =IF(LEFT(A2,LEN(C1))=C1,"Yes","No") adapts to whatever length C1 happens to be.
In Excel, while working with data, there might be a situation when you need to check if the value in a cell starts with a particular text or if the starting part of that value is a number or not. In this tutorial, we will learn to write a formula to test both conditions.
IF a Cell Value Starts with a Particular Text
In the following example, you need to check if the starting three characters of the cell are equal to LXI. For this, you need to use IF and LEFT.

You can use the below steps to write this formula:
- First, enter the IF function in a cell.
- After that, enter the LEFT function in the first argument of the IF, and refer to cell A2, where you have the value. In the second argument of LEFT, use 3 for num_chars.
- Next, use the equal sign and enter the value (using double quotation marks) that you want to test.
- Now, in the second argument, enter “Yes”.
- And in the third argument, enter “No”.
- In the end, enter the closing parentheses and hit Enter to get the result.

As you can see below, for all the values that have “LXI” at the start, it returns Yes, else No.

=IF(LEFT(A2,3)="LXI","Yes","No")
This comparison isn’t case-sensitive, so “lxi-002” also returns Yes. If the case needs to match as well, use EXACT to compare the text:
=IF(EXACT(LEFT(A2,3),"LXI"),"Yes","No")
And if the text you want to test is in a cell (D1 here) and its length can change, use LEN to take the same number of characters from the start:
=IF(LEFT(A2,LEN(D1))=D1,"Yes","No")
Another way is COUNTIF with an asterisk (*) wildcard after the text, which means “anything after LXI”. COUNTIF returns 1 when the cell starts with LXI, and IF reads 1 as TRUE:
=IF(COUNTIF(A2,"LXI*"),"Yes","No")
Count IF the Cells Start With
Use the below formula if you want to count the number of cells that start with a particular value.

=SUMPRODUCT(--(LEFT(A2:A10,3)="LXI"))
To learn more about this, you can learn about using SUMPRODUCT with a Condition.
You can also count them with COUNTIF and the asterisk wildcard. It’s shorter and gives the same result:
=COUNTIF(A2:A10,"LXI*")
Note that COUNTIF with a wildcard only looks at text values; a cell with the number 123 isn’t counted by “12*”.
If a Cell Value Starts with a Number
In the same way, you can write a formula to check if a cell starts with a number.

=IF(ISNUMBER(VALUE(LEFT(A2,1))), "Yes","No")
In this formula, LEFT takes the first character of the cell (num_chars 1), and we have used the VALUE function around the LEFT. When you get a value by using LEFT, it returns that value as text, even if that value is a number.
That’s why, to convert that text into a number, we need to use VALUE. After that, we used ISNUMBER to test the value returned by VALUE. If that value is a number, the condition is TRUE, and IF returns Yes, else No. A value that starts with a minus sign, like -5, returns No, as the first character is “-”.
Check If a Cell Starts with One of Several Values
To test more than one starting text, put the conditions in the OR function. The following formula returns Yes when the cell starts with LXI or ABC:
=IF(OR(LEFT(A2,3)="LXI",LEFT(A2,3)="ABC"),"Yes","No")
And in Microsoft 365 and Excel 2021, you can get all the values that start with LXI in one go with FILTER:
=FILTER(A2:A10,LEFT(A2:A10,3)="LXI")
Frequently Asked Questions
Is there a STARTSWITH function in Excel?
No. Excel doesn’t have one, so you use LEFT with a comparison, or COUNTIF with a wildcard, as shown above.
How do I check if a cell ends with a text?
Use RIGHT instead of LEFT, or put the asterisk before the text in COUNTIF, like “*LXI”.
=IF(RIGHT(A2,3)="LXI","Yes","No")
Why does my formula return No for a value that starts with the text?
The cell probably has a space or another hidden character at the start. Check it with LEN, and clean it with TRIM, like LEFT(TRIM(A2),3).
Written by
Puneet Gogia
Microsoft MVP — Excel · Founder, Excel Champs
Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.