Excel Formula to Check Whether a Task Contains Sam or Max
Question details
Create a formula that returns Okay if a task assignment contains Sam or Max, and Not Okay if it contains neither name.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Check task assignment text in a worksheet and display a status for each row.
- Observed behavior
- The desired result is Okay when either name appears in the assignment text and Not Okay otherwise.
Identify the column containing the task assignment text and an empty column for the results. The example below assumes the first assignment is in cell B2.
Use SEARCH and OR to check the assignment text
Use this formula to find either name anywhere in the cell, regardless of capitalization.
In Excel, click C2, or choose an empty cell beside the first task assignment.
Enter =IF(OR(ISNUMBER(SEARCH("sam",B2)),ISNUMBER(SEARCH("max",B2))),"Okay","Not Okay") and press Enter. Replace B2 if the assignment text is in a different cell.
Select C2 and drag the fill handle down the result column to apply the formula to the remaining rows.

Check task assignments with a formula in WPS Spreadsheet
Open your worksheet in WPS Spreadsheet and use the same IF, OR, ISNUMBER, and SEARCH formula to label assignments containing Sam or Max.
- 1. Open the worksheet: Launch WPS Spreadsheet and use Open to select your workbook.
- 2. Choose a result cell: Click C2 next to the first assignment, assuming its text is in B2.
- 3. Enter the formula: Type =IF(OR(ISNUMBER(SEARCH("sam",B2)),ISNUMBER(SEARCH("max",B2))),"Okay","Not Okay") and press Enter.
- 4. Apply it to other tasks: Drag the fill handle from C2 down the result column, then use File > Save to save the workbook.

Frequently Asked Questions
Does the formula distinguish between Sam and SAM?
No. SEARCH is not case-sensitive, so Sam, SAM, and sam all match.
What happens if both Sam and Max appear in the same cell?
The formula returns Okay because OR requires at least one of the two SEARCH checks to succeed.
What does the formula return for an empty assignment cell?
It returns Not Okay because neither Sam nor Max is found in the empty cell.
Will the formula match names inside longer words?
Yes. SEARCH finds the specified text anywhere in the cell, so words such as Samantha can also produce Okay.




