How to Prepare IF Statement Contains Multiple Words in Excel: 4 Methods

Method 1 – Use of Nested IF Function to Check Multiple Conditions

Steps:  

  • Use the IF function in the column to get the desired output.

Image of Dataset for Excel IF Statement contains multiple words

  • Type the following formula in the F7 cell:
=IF(E7>=700,"Limit Reached",IF(E7>=500,"Payment Required",IF(E7>300,"Give Reminder","Visit Buyer")))

Nested IF Formula Statement

  • Hit Enter. This shows the output in cell F7.

Output of the Formula

  • Hold and drag the AutoFill icon from the bottom right edge of cell F7 to cell F12. This will automatically imply the formula we’ve used in cell F7 and make necessary adjustments to all the cells from F8 to F12.

AutoFill column

The output in the “Comment” column.

Output of AutoFill


Method 2 – Multiple Strings Search with IF Function

Steps:

  • Write the following formula in the C7 cell:
=IF(AND(ISNUMBER(SEARCH("Red",B7)),ISNUMBER(SEARCH("Wax",B7))),"Red Wax Detected ","Not Found")

Formula in Cell C7

Formula Breakdown

  • SEARCH(“Red”,B7) > Here SEARCH function is looking for the position of substring Red in cell B7
    Output: 
    1
  • ISNUMBER(1) > ISNUMBER checks whether the argument is a number or not
    Output: TRUE
  • SEARCH(“Wax”,B7) > Here SEARCH function is looking for the position of substring Red in cell B7
    Output:
    5
  • ISNUMBER(5) > ISNUMBER checks whether the argument is a number or not
    Output: TRUE
  • AND(TRUE,TRUE) > AND function has two TRUE arguments.
    Output: TRUE
  • IF(TRUE,”Red Wax Detected “,”Not Found”) > IF will get this type of arguments within it and will return depending on the logic.
    Output: Red Wax Detected
  • The output looks like this:

Output of the Formula

  • AutoFill is performed from cell C8 to cell C12

AutoFill other cells

  • The dataset is filled with all the desired output.

Final Output

We wrote an IF statement that contains multiple words in Excel.


Method 3 – Matching Any String with IF and TEXTJOIN

Steps:

  • Type the following formula in the C7 cell and hit Enter.
=TEXTJOIN(", ", TRUE, IF(COUNTIF(B7, "*"&$E$7:$E$9&"*"), $E$7:$E$9, ""))

Formula in cell C7

We explained the calculations here (The Active Function is BOLD form and the Output is in BOLD & ITALIC format):

  • COUNTIF function returns the number of times a singular entity is present in a predefined range. We’re looking for “IFERROR, AND” and “LEN” which span cells E7 to E9. Here Absolute Reference is used to keep this particular part of the formula unchanged in any situation.
  • We’re applying the COUNTIF function in cell B7; this is the first argument of the function COUNTIF.

=TEXTJOIN(“, “, TRUE, IF(COUNTIF(B7, “*”&$E$7:$E$9&”*”), $E$7:$E$9, “”))

  • The following calculation is shown here:

=TEXTJOIN(“, “, TRUE, IF(COUNTIF($B$7, {“*IFERROR”;”*AND”;”*LEN”}&”*”), $E$7:$E$9, “”))

  • Next line:

=TEXTJOIN(“, “, TRUE, IF(COUNTIF($B$7, {“*IFERROR”;”*AND”;”*LEN”}&”*”), $E$7:$E$9, “”))

  • The output of the COUNTIF function shows that IFERROR and AND are present in the B7 cell; both one time only, it returned {1:1:0}. Now, the IF function is active.

=TEXTJOIN(“, “, TRUE, IF({1;1;0}, $E$7:$E$9, “”))

  • The output of the IF function returns the values “IFERROR” ;“AND”; “ ” as IFERROR and AND are searched in $E$7:$E$9. Now, the TEXTJOIN function is active.

=TEXTJOIN(“, “, TRUE, {“IFERROR”;”AND”;” “})

  • The task of the TEXTJOIN function is combining the text from multiple ranges and or strings. The output looks like this. And it matches our target.

IFERROR, AND

  • See the output in cell C7.

Output of the Excel IF Statemnet Formula

  • AutoFill is performed from cell C8 to cell C11

AutoFill column

  • The dataset is filled with all the desired output.

Output of AutoFill

 


Method 4 – IF to Check Presence of a String in Text

Steps:

  • In cell C7, type the following formula and press Enter.
=IF(OR(ISNUMBER(SEARCH("IFERROR",B7)),ISNUMBER(SEARCH("LEN",B7)),ISNUMBER(SEARCH("SUM",B7))),"Present","Absent")

IF Statement with multiple words Formula in cell C7

The calculation is shown here (The Active Function is BOLD form and the Output is in BOLD & ITALIC format)

  • SEARCH function in bold is being evaluated here. Here SEARCH function is looking for

the position of substring IFERROR in cell B7

=IF(OR(ISNUMBER(SEARCH(“IFERROR”,B7)),ISNUMBER(SEARCH(“LEN”,B7)),ISNUMBER(SEARCH(“SUM”,B7))),”Present”,”Absent”)

  • The B7 cell value is passed in the argument of SEARCH function

=IF(OR(ISNUMBER(SEARCH(“IFERROR”,”IF, AND IFERROR”)),ISNUMBER(SEARCH(“LEN”,B7)),ISNUMBER(SEARCH(“SUM”,B7))),”Present”,”Absent”)

  • SEARCH function returns the value 10, which is now working as the argument of bold ISNUMBER:

=IF(OR(ISNUMBER(10),ISNUMBER(SEARCH(“LEN”,B7)),ISNUMBER(SEARCH(“SUM”,B7))),”Present”,”Absent”)

  • 10 is a number, so, ISNUMBER returns TRUE. At this stage, bolded SEARCH is active, and the abovementioned process is repeated.

=IF(OR(TRUE,ISNUMBER(SEARCH(“LEN”,B7)),ISNUMBER(SEARCH(“SUM”,B7))),”Present”,”Absent”)

  • The content of the B7 cell is now in the argument of SEARCH function

=IF(OR(TRUE,ISNUMBER(SEARCH(“LEN”,IF, AND, IFERROR”)),ISNUMBER(SEARCH(“SUM”,B7))),”Present”,”Absent”)

  • SEARCH function returns #VALUE which means “LEN” is not present in B7. Now, the ISNUMBER function is activated.

=IF(OR(TRUE,ISNUMBER(#VALUE!),ISNUMBER(SEARCH(“SUM”,B7))),”Present”,”Absent”)

  • ISNUMBER function returns FALSE which means its argument is not a number. Now, the SEARCH function is activated.

=IF(OR(TRUE,FALSE,ISNUMBER(SEARCH(“SUM”,B7))),”Present”,”Absent”)

  • Output of the SEARCH function is found, and we got it as explained above.

=IF(OR(TRUE,FALSE,ISNUMBER(SEARCH(“SUM”,IF, AND, IFERROR”))),”Present”,”Absent”)

  • Output of the SEARCH function is also explained above.

=IF(OR(TRUE,FALSE,ISNUMBER(#VALUE!)),”Present”,”Absent”)

  • Output of the ISNUMBER function is FALSE and also explained before. Now OR function is active.

=IF(OR(TRUE,FALSE,FALSE),”Present”,”Absent”)

  • Output of the OR function is TRUE as at least one argument of the function is TRUE. Now IF function is active.

=IF(TRUE,”Present”,”Absent”)

  • The output Present. This means the looked-up string(s) are present in cell B7.

Present

  • The output is shown in the cell.

Output of the Formula

  • AutoFill is performed from cell C8 to cell C11

AutoFill column

  • The dataset is filled with all the desired output.

If Statement Contains Multiple Words Output of AutoFill in Excel


Download Practice Workbook

You can download the file from the link below.


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Hadi Ul Bashar
Hadi Ul Bashar

Hadi Ul Bashar holds a BSc degree in Biomedical Engineering from Bangladesh University of Engineering and Technology.  In January 2023, Bashar joined SOFTEKO as an Excel and VBA content developer. Since then, he has authored over 50 articles. He was engaged in two specialized training programs focused on VBA and Chart & Dashboard designing in Excel. Currently he is creating video content on Excel and VBA and has created over 70 videos. Reading books and traveling are his... Read Full Bio

2 Comments
  1. Reply
    Danny Van Straten Jul 25, 2023 at 4:49 PM

    How do i setup a formula to Validate Column K(any value from 0-8;multiple lines (115) and then Display the corresponding value in Words(column T) in Column L.
    List in Column S and T
    1 Permanent Morning /Day shift
    2 Permanent Afternoon shift
    3 Permanent Night shift
    4 Rotational-Morning and Afternoon Shift
    5 Rotational-Morning and Night Shift
    6 Rotational-Afternoon and Night Shift
    7 Rotational-Morning ,Afternoon and Night Shift
    8 Employees who work different workschedules on the same Org unit

    If this make sense? tx

    • Dear Danny Van Straten,

      If you need any types of customized templates you may contact us through [email protected]
      We have a expert team to create any types of professional templates.

      Regards
      ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo