Function to find a portion of text in a cell

Nathan Asius

New Member
Joined
Jan 15, 2024
Messages
41
Office Version
  1. 365
Platform
  1. Windows
I'm looking to build a formula with a series of nested IF(AND statements where one of the two conditions in each IF statement looks for a certain portion of a text in a cell.
For example if A1 contains "44 White Birds", and A2 contains "Willow Tree" I need cell A10 to look for "44W" in A1, and "Willow" in A2 and return a range named 'BirdWillow'. So the formula is only looking for a portion of a text string (that may contain letters and numbers), in each cell.
I've tried the following formula and in testing it I receive the error of too many arguments.

=IF(AND(ISNUMBER(SEARCH("44W",A1))),ISNUMBER(SEARCH("Willow",A2)),WillowSpecies, IF(AND(ISNUMBER(SEARCH("22F",A3))),ISNUMBER(SEARCH("Maple",A4)),MapleSpecies, IF(AND(ISNUMBER(SEARCH("6 Bark",A5))),ISNUMBER(SEARCH("Elm",A6)),ElmSpecies, IF(A7="Books","Bookcase",""))

I've played around with the syntax trying to re-arrange the parenthesis but I am not successful. I don't know if it's the syntax or if the Functions are entirely wrong. On my worksheet I don't have the spacing between the IF. I only did that to display the two conditions of each IF(AND.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
You are closing the ANDs to early, try
Excel Formula:
=IF(AND(ISNUMBER(SEARCH("44W",A1)),ISNUMBER(SEARCH("Willow",A2))),WillowSpecies, IF(AND(ISNUMBER(SEARCH("22F",A3)),ISNUMBER(SEARCH("Maple",A4))),MapleSpecies, IF(AND(ISNUMBER(SEARCH("6 Bark",A5)),ISNUMBER(SEARCH("Elm",A6))),ElmSpecies, IF(A7="Books","Bookcase",""))))
 
Upvote 0
Solution
That doesn't seem to work. I've painstakingly looked over every character of the formula and I have it exactly as you wrote it. I get this standard error.
 

Attachments

  • Screenshot 2024-02-13 152444.png
    Screenshot 2024-02-13 152444.png
    14.7 KB · Views: 37
Upvote 0
Did you retype the formula or copy it using the copy icon top right hand side of the code tags?
 
Upvote 0
I had copied it as well as re-typed it. At first neither was working. But then something I did changed the syntax in the formula and it works. I must have inadvertently put a typo in.

The formula does what I need. Thanks Fluff.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top