Formula help for text string data

mwhite17

New Member
Joined
Aug 5, 2017
Messages
8
Hi,

Please could I get some help for this formula?

I have this formula that matches a text cell, to a text range, and then provides the value of a new cell. Like below.

=INDEX($B$2:$B$6,MATCH(1,COUNTIF(C4,"*"&$A$2:$A$6&"*"),0))

A B C D
Idea Category Rating Respondents Ideas Respondents Rating
Ship 1 Heart 4
Boat 2 Love 3
Love 3 Boat 2
Heart 4 Ship 1
(formula column)

If possible, I would like the formula to match any cell in column C, which contains the string in column A. At the moment it is only working for direct matches between cells but I have some cells that have other words, such as 'Big Boat', 'Sailing Ship, but I want them to be picked up by boat and ship respectively.

Thanks,
Matt
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I think this already does what I want
Are you sure? If column A contains "Love" and column C contains "Slovenly" your formula counts that as a match. Is that what you want?
 
Upvote 0
If you wanted to match whole words only, you could try this in D2, copied down.

=LOOKUP(9.99E+307,SEARCH(" "&A2&" "," "&$C$2:$C$6&" "),$B$2:$B$6)
 
Upvote 0
If you wanted to match whole words only, you could try this in D2, copied down.

=LOOKUP(9.99E+307,SEARCH(" "&A2&" "," "&$C$2:$C$6&" "),$B$2:$B$6)

Hi Peter,

Thanks for your help. Yes I would only like to match individual words. I've tried your formula in my sheet but I'm getting an N/A error.

Thanks,
Matt
 
Upvote 0
I've tried your formula in my sheet but I'm getting an N/A error.
That should only occur if there is no match (& you haven't said what you want to happen if that occurs).
Here is my sheet. Formula in D2 is copied down.
Do I have the setup wrong?

Excel Workbook
ABCD
1Idea CategoryRatingRespondents IdeasRespondents Rating
2Ship1Heart4
3Boat2Love3
4Love3Big Boat2
5Heart4Sailing Ship1
6Bus5Big Business#N/A
mwhite17
 
Last edited:
Upvote 0
That should only occur if there is no match (& you haven't said what you want to happen if that occurs).
Here is my sheet. Formula in D2 is copied down.
Do I have the setup wrong?

mwhite17



ABCD
Idea CategoryRespondents Ideas
ShipHeart
BoatLove
LoveBig Boat
HeartSailing Ship
BusBig Business#N/A

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:100px;"><col style="width:56px;"><col style="width:132px;"><col style="width:138px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="align: center"]Rating[/TD]

[TD="align: center"]Respondents Rating[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="align: center"]1[/TD]

[TD="align: center"]4[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]

[TD="align: center"]5[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
D2=LOOKUP(9.99E+307,SEARCH(" "&A2&" "," "&$C$2:$C$6&" "),$B$2:$B$6)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Column A is made of of common text strings from Column C, so I shouldn't get an #N/As.

I've got your formula working, but it doesn't seem to work when there are duplicate values in Column C.

If I put input 'Heart' in C6, it changes the rating of D5 and D6 remains as #N/A.

Thanks
 
Upvote 0
Sorry, my formula was quite flawed. Try this instead. If this still doesn't do what you expect, please provide some sample data (say 8-10 rows) together with the expected results and any further clarification that you can give.

Excel Workbook
ABCD
1Idea CategoryRatingRespondents IdeasRespondents Rating
2Ship1Heart4
3Boat2Tractor#N/A
4Love3Big Boat2
5Heart4Sailing Ship1
6Bus5Broken Heart4
mwhite17
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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