Need to write a search array formula to search different columns

healthseo

New Member
Joined
Oct 9, 2013
Messages
2
Hello, I need to write a search formula that will search for text in several columns and then return a value in a separate cell. The value returned will be taken from the cell to the left of where the text is discovered. If I use the following table as an example I want to report the price of apples in each shop so I will have a separate formula for each shop. The answers should be Shop 1 .40, Shop 2 .50, Shop 3 .60. It also worth noting that sometimes the text in the cell I am looking for is different eg green apple, red apple so I need to pick out the work apple. Thanks
ABCDEFGH
Shop 1.40green apple1banana.2strawberries2pineapple
Shop 22banana.50delicious apple
Shop 3 3melon.5strawberries.6apple packs
Shop 43mango3sweet pineapple


<tbody>
</tbody>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Thanks for this. Works great. The only problem is that I am left with N/As in the blank cells. Can I adjust the formula to leave these blank?
 
Upvote 0
You can use IFERROR(INDEX(A2:H2,MATCH("*"&"apple"&"*",A2:H2,0)-1),0)
or
IFERROR(INDEX(A2:H2,MATCH("*"&"apple"&"*",A2:H2,0)-1),"")

depending on whether you want a 0 or blank text when there's an error.

I'm also unsure how this formula deals with lines when it doesn't find apple, like shop 4 in your example, worth looking out for incase it's adding extra values when it doesn't find apple
 
Upvote 0

Forum statistics

Threads
1,215,693
Messages
6,126,237
Members
449,304
Latest member
hagia_sofia

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