ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Logic
  3. IF With Text in Excel: Check Words and Partial Matches

IF With Text in Excel: Check Words and Partial Matches

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

To check if a cell equals a word, use =IF(A2="Paid","Done","Chase"). To check if a cell contains a word anywhere, use =IF(ISNUMBER(SEARCH("refund",B2)),"Refund","Other"). SEARCH finds the word's position or returns an error, and ISNUMBER turns that into TRUE or FALSE. Wildcards like * don't work with = inside IF.

Key takeaways

  • =IF(A2="Paid",...) checks for an exact match, and it ignores upper and lower case.
  • For "contains", use IF(ISNUMBER(SEARCH("word",A2)),...): SEARCH is not case-sensitive, FIND is.
  • IF(A2="word",...) does not work: = treats the * as a normal character.
  • COUNTIF does understand wildcards, so =IF(COUNTIF(A2,"word"),...) is another way to test one cell.
  • Use EXACT for a case-sensitive match and TRIM to ignore stray spaces.
On this page+
  1. How to use IF with text: exact matches
  2. How to check if a cell contains text anywhere (partial match)
  3. Why doesn't IF work with wildcards?
  4. How to make a case-sensitive text check
  5. How to check for several words: OR and AND
  6. How to check whether a cell has any text, or is empty
  7. How to count or sum cells that contain text
  8. Common mistakes with IF and text
  9. Practise it

To test if a cell contains text in Excel, you combine IF with a check that suits the job: = for an exact word, or ISNUMBER and SEARCH for a word anywhere in the cell. This guide is for anyone who knows the basic IF function and now needs it to work with words, such as labelling support tickets, flagging statuses or sorting product names.

How to use IF with text: exact matches#

To check whether a cell equals a word, compare it with the word in double quotes.

Excel formula
=IF(A2="Paid","Done","Chase")

If A2 is Paid, the result is Done; anything else gives Chase. Three rules to remember:

  • Text inside a formula always needs double quotes: "Paid", not Paid. Without quotes Excel looks for a named range called Paid and returns #NAME?.
  • The comparison ignores case: "paid", "Paid" and "PAID" all match.
  • Spaces count: "Paid " with a trailing space does not match "Paid". Use =IF(TRIM(A2)="Paid","Done","Chase") to ignore extra spaces.

To test the opposite, use <> (not equal to): =IF(A2<>"Paid","Chase","Done"). The IF function guide covers the full syntax.

How to check if a cell contains text anywhere (partial match)#

To find a word anywhere inside a cell, use SEARCH inside ISNUMBER inside IF. Here is a list of support tickets:

ABC
1TicketSubjectType
2T-101Refund for order 4412Refund
3T-102Delivery delayedOther
4T-103REFUND not receivedRefund
5T-104Change delivery addressOther
6T-105Return and refund requestRefund
7T-106Invoice copyOther

In C2, type and fill down:

Excel formula
=IF(ISNUMBER(SEARCH("refund",B2)),"Refund","Other")

How it works, from the inside out:

  1. SEARCH("refund",B2) looks for "refund" in B2. If it finds it, it returns the position (1 for "Refund for order 4412"). If not, it returns #VALUE!.
  2. ISNUMBER(...) turns a position into TRUE and the #VALUE! error into FALSE.
  3. IF(...) shows Refund for TRUE and Other for FALSE.

SEARCH ignores case, so "REFUND not received" also matches. Our guide to FIND and SEARCH in Excel explains both functions in more depth.

Why doesn't IF work with wildcards?#

The = comparison in IF doesn't understand wildcards. This formula looks for the literal text *delivery*, asterisks included, so it returns "No" for every row:

Excel formula
=IF(B5="*delivery*","Yes","No")

Wildcards only work in functions built for criteria, such as COUNTIF, SUMIF and XLOOKUP. That gives you a second way to write a "contains" test:

Excel formula
=IF(COUNTIF(B5,"*delivery*"),"Yes","No")

COUNTIF counts 1 if B5 contains "delivery" and 0 if not. IF treats 1 as TRUE and 0 as FALSE, so B5 ("Change delivery address") returns Yes. Both methods work in every Excel version; ISNUMBER(SEARCH()) is more common and easier to extend. See wildcards in Excel criteria for the * and ? rules.

How to make a case-sensitive text check#

Use FIND instead of SEARCH, or EXACT instead of =, when capitals matter.

TaskCase-insensitiveCase-sensitive
Cell equals a word=IF(A2="Paid",...)=IF(EXACT(A2,"Paid"),...)
Cell contains a word=IF(ISNUMBER(SEARCH("refund",B2)),...)=IF(ISNUMBER(FIND("refund",B2)),...)

With FIND, "REFUND not received" returns Other, because FIND treats R and r as different letters. Use it for codes where case matters, such as product IDs that use both. For a full side-by-side, see FIND vs SEARCH.

How to check for several words: OR and AND#

To flag a cell that contains any one of several words, put each test inside OR.

Excel formula
=IF(OR(ISNUMBER(SEARCH("refund",B2)),ISNUMBER(SEARCH("return",B2))),"Money back","Other")

Ticket T-105, "Return and refund request", returns Money back. To require all the words, swap OR for AND. For more than two results, such as Refund, Delivery and Other, nest IFs, putting the second IF in the "value if false" slot:

Excel formula
=IF(ISNUMBER(SEARCH("refund",B2)),"Refund",IF(ISNUMBER(SEARCH("deliver",B2)),"Delivery","Other"))

Excel checks the tests in order and stops at the first TRUE. Our guide to nested IF shows how to keep longer chains readable.

How to check whether a cell has any text, or is empty#

Sometimes you don't care which word is in the cell, only whether there is one.

  • =IF(ISTEXT(A2),"Text","Not text") is TRUE only for text, not numbers.
  • =IF(A2<>"","Filled","Empty") is TRUE for anything at all, text or numbers.
  • =IF(LEFT(A2,2)="T-","Ticket","Other") checks how the text starts.

If you need to pick a label from a list by number instead, such as 1 = Morning, 2 = Afternoon, the CHOOSE function is shorter than a chain of IFs.

How to count or sum cells that contain text#

If you only need to know how many cells contain a word, you don't need IF or a helper column. COUNTIF with wildcards does it in one cell:

Excel formula
=COUNTIF(B2:B7,"*refund*")

This returns 3: tickets T-101, T-103 and T-105. The asterisks mean "any text before or after", and COUNTIF ignores case. SUMIF works the same way for totals: with amounts in column D, =SUMIF(B2:B7,"*refund*",D2:D7) adds the amounts of every refund ticket. To use a word typed in a cell, say F1, join the wildcards to it: "*"&F1&"*".

Common mistakes with IF and text#

  • Missing quotes around the word, which gives #NAME?.
  • Using * with =, which never matches (see above).
  • Forgetting ISNUMBER: =IF(SEARCH("refund",B2),"Refund","Other") works when the word is found, but returns #VALUE! instead of "Other" when it isn't.
  • Hidden spaces in imported data. Wrap the cell in TRIM before comparing.
  • Short words matching inside longer ones. SEARCH("art",B2) also matches "start" and "party". Search for a longer phrase, or include a space, such as " art ", if that matters.
  • Numbers stored as text. =IF(A2=100,...) won't match a cell holding the text "100". Compare with "100" or convert the cell first.

Practise it#

Try the live exercise on this page to label the refund tickets. Then practise the IF function in a live spreadsheet for pass/fail and over/under checks, and use the FIND and SEARCH lesson to get comfortable with the position numbers that make "contains" tests work.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

In C2, show Refund if the subject in B2 contains the word "refund" anywhere (in any capitals), and Other if it doesn't. Use IF, ISNUMBER and SEARCH.

fx
ABCD
1
Ticket
Subject
Type
2
T-101
Refund for order 4412
3
T-102
Delivery delayed
4
T-103
REFUND not received
5
T-104
Change delivery address
6
T-105
Return and refund request
7
T-106
Invoice copy
8
9
10

Tip: SEARCH("refund",B2) finds the word. Wrap it in ISNUMBER to get TRUE or FALSE, then put that inside IF.

Practise this in a lesson

LessonThe IF functionMake a cell show one result or another depending on a condition, like Pass/Fail or Over/Under budget.LessonFIND and SEARCHLocate a character or word inside text with FIND or SEARCH, then use that position to split names and pull out order numbers.Function guideIFLearn Excel's IF function with practical examples: flag budgets, label rows and return blanks. Avoid the classic mistakes and practice live.

Frequently asked questions

How do I check if a cell contains specific text in Excel?

+

Use =IF(ISNUMBER(SEARCH("text",A2)),"Yes","No"). SEARCH returns a number when it finds the text anywhere in the cell, and ISNUMBER turns that into TRUE.

Why doesn't IF work with a wildcard like "*text*"?

+

The = comparison in IF does not support wildcards, so it looks for a literal asterisk. Use ISNUMBER(SEARCH()) or COUNTIF(A2,"text") inside IF instead.

Is IF case-sensitive with text?

+

No. =IF(A2="paid",...) matches Paid, PAID and paid. For a case-sensitive test, use =IF(EXACT(A2,"Paid"),...).

How do I check if a cell contains one of several words?

+

Put several ISNUMBER(SEARCH()) tests inside OR: =IF(OR(ISNUMBER(SEARCH("refund",A2)),ISNUMBER(SEARCH("return",A2))),"Yes","No").

How do I check if a cell has any text at all?

+

Use =IF(ISTEXT(A2),"Text","Not text") to test for text, or =IF(A2<>"","Filled","Empty") to test whether the cell has anything in it.

Sources

  • IF function - Microsoft Support
  • SEARCH, SEARCHB functions - Microsoft Support
  • IS functions - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How to use IF with text: exact matches
  2. How to check if a cell contains text anywhere (partial match)
  3. Why doesn't IF work with wildcards?
  4. How to make a case-sensitive text check
  5. How to check for several words: OR and AND
  6. How to check whether a cell has any text, or is empty
  7. How to count or sum cells that contain text
  8. Common mistakes with IF and text
  9. Practise it

Keep reading

Logic· 7 min read

The CHOOSE Function in Excel

CHOOSE returns the value at a given position in a list you type into the formula. =CHOOSE(2,"Morning","Afternoon","Night") returns Afternoon, because it is item 2. The first argument must be a number from 1 to the number of items, or CHOOSE returns #VALUE!. It works in every version of Excel.

Logic· 6 min read

The Excel IF Function Explained Simply

The Excel IF function checks a condition and returns one value when it's TRUE and another when it's FALSE. The syntax is =IF(logical_test, value_if_true, value_if_false). For example, =IF(B2>=70,"Pass","Fail") shows Pass for a score of 70 or more and Fail for anything lower. Text results go in double quotes.

Text· 7 min read

Find the Position of Text in a Cell (FIND and SEARCH)

FIND and SEARCH return the position of some text inside a cell, as a number. =FIND(" ",A2) gives 5 for Dana Whitfield, because the space is the 5th character. FIND is case-sensitive; SEARCH ignores capitals and allows wildcards. Both return #VALUE! when the text isn't there, so wrap them in ISNUMBER to test whether a cell contains a word.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free