Index/Match - Return value if partial text from cell contained in separate column

excelnewb221

New Member
Joined
Dec 14, 2022
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hello,

Hoping for some help. Unfortuanately the Xl2bb Addin is disabled on my computer by Admin access.

I have 2 columns.
Column A, contains the source data. This column contains a string of words.
Column B will contain the formula.
Column C contains a string of words. These values may or may not be in Column A.
However, if any word from the cell in column C, matches any word from a cell in column A, please return that value from column A, next to its respective cell from column C.

This is basically what I'm trying to accomplish:
Data (column A)Formula (column B)Original Value (column C)Formula will produce:
Apple Carrot OrangeOrange CarrotApple Carrot Orange
Beet Tomato OnionTomatoBeet Tomato Onion
Pepper Banana GrapeGrape JuicePepper Banana Grape
Lettuce Kale ChiaKale Spinach BroccoliLettuce Kale Chia
Apple Carrot OrangeOrange CarrotApple Carrot Orange
Beet Tomato OnionBeet JuiceBeet Tomato Onion
Pepper Banana GrapeStrawberryN/A
Lettuce Kale ChiaKaleLettuce Kale Chia
Apple Carrot OrangeOrangeApple Carrot Orange
Beet Tomato OnionJuiceN/A


And below are the terrible attempts I've made. I clearly don't know how to make this work.
Not really sure the best approach to take, so hoping someone could help guide me in that regard.
Please let me know what is needed to better articulate what I'm trying to achieve. Really appreciate any help.

DataFormula Column Formula WrittenOriginal ValueValue for Formula to WorkProblem
Apple Carrot OrangeBeet Tomato OnionINDEX(A2:A5,MATCH(E2,A2:A5))Orange CarrotOrange CarrotIndex/Match - returns value from 2nd row?
Beet Tomato OnionBeet Tomato OnionVLOOKUP(E3&"*",A:A,1,FALSE)Beet JuiceBeetVlookup - only returns if first word matches?
Pepper Banana GrapePepper Banana GrapeVLOOKUP(E4&"*"&"*",A:A,1,FALSE)Grape JuicePepperVlookup - only returns if first word matches?
Lettuce Kale ChiaLettuce Kale ChiaINDEX(A2:A5,MATCH("*"&E5,A2:A5,0))Kale Spinach BroccoliChiaIndex/Match - only returns if last word matches
Apple Carrot Orange
0​
XLOOKUP(TRUE,ISNUMBER(SEARCH(D6:D9,A6)),D6:D9,0)Orange Carrot
Beet Tomato Onion
0​
FILTER(D6:D9,ISNUMBER(SEARCH(D6:D9,A6)),0)Beet Juice
Pepper Banana Grape
#N/A​
MATCH(TRUE,ISNUMBER(SEARCH(D6:D9,A6)),0)Grape Juice
Lettuce Kale Chia
#N/A​
XLOOKUP("*"&D9&"*",A6:A9,A6:A9,,2)Kale Spinach BroccoliOnly works if column C contains one word
Apple Carrot Orange
#N/A​
INDEX(A7:A10,MATCH("*"&D10,A7:A10,0))Apple Orange
Beet Tomato Onion
#N/A​
INDEX(A8:A11,MATCH("*"&D11&"*",A8:A11,0))Beet Juice
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How about this approach?

Book6
ABCD
1Data (column A)Formula (column B)Original Value (column C)Formula will produce:
2Apple Carrot OrangeApple Carrot OrangeOrange CarrotApple Carrot Orange
3Beet Tomato OnionBeet Tomato OnionTomatoBeet Tomato Onion
4Pepper Banana GrapePepper Banana GrapeGrape JuicePepper Banana Grape
5Lettuce Kale ChiaLettuce Kale ChiaKale Spinach BroccoliLettuce Kale Chia
6Apple Carrot OrangeApple Carrot OrangeOrange CarrotApple Carrot Orange
7Beet Tomato OnionBeet Tomato OnionBeet JuiceBeet Tomato Onion
8Pepper Banana GrapeN/AStrawberryN/A
9Lettuce Kale ChiaLettuce Kale ChiaKaleLettuce Kale Chia
10Apple Carrot OrangeApple Carrot OrangeOrangeApple Carrot Orange
11Beet Tomato OnionN/AJuiceN/A
Sheet1
Cell Formulas
RangeFormula
B2:B11B2=IF(0<>SUM(--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2))),A2,"N/A")
 
Upvote 1
Solution
How about this approach?

Book6
ABCD
1Data (column A)Formula (column B)Original Value (column C)Formula will produce:
2Apple Carrot OrangeApple Carrot OrangeOrange CarrotApple Carrot Orange
3Beet Tomato OnionBeet Tomato OnionTomatoBeet Tomato Onion
4Pepper Banana GrapePepper Banana GrapeGrape JuicePepper Banana Grape
5Lettuce Kale ChiaLettuce Kale ChiaKale Spinach BroccoliLettuce Kale Chia
6Apple Carrot OrangeApple Carrot OrangeOrange CarrotApple Carrot Orange
7Beet Tomato OnionBeet Tomato OnionBeet JuiceBeet Tomato Onion
8Pepper Banana GrapeN/AStrawberryN/A
9Lettuce Kale ChiaLettuce Kale ChiaKaleLettuce Kale Chia
10Apple Carrot OrangeApple Carrot OrangeOrangeApple Carrot Orange
11Beet Tomato OnionN/AJuiceN/A
Sheet1
Cell Formulas
RangeFormula
B2:B11B2=IF(0<>SUM(--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2))),A2,"N/A")
this is absolutely incredible. i've tested it out a bunch, and it's perfect. thank you so much.
if you have more time, do you think you can explain how the formula works? it's beyond me, but would love to understand it.
 
Upvote 0
Do these 2 examples with the step-by-step help?

Book6
ABCDEFG
1Data (column A)Formula (column B)Original Value (column C)Transpose portion of A2SearchIsnumberSum
2Apple Carrot OrangeApple Carrot OrangeOrange CarrotOrange1412
3Beet Tomato OnionBeet Tomato OnionTomatoCarrot71
4Pepper Banana GrapePepper Banana GrapeGrape Juice
5Lettuce Kale ChiaLettuce Kale ChiaKale Spinach Broccoli
6Apple Carrot OrangeApple Carrot OrangeOrange Carrot
7Beet Tomato OnionBeet Tomato OnionBeet JuiceTranspose for A8
8Pepper Banana GrapeN/AStrawberryStrawberry#VALUE!00
9Lettuce Kale ChiaLettuce Kale ChiaKale
10Apple Carrot OrangeApple Carrot OrangeOrange
11Beet Tomato OnionN/AJuice
Sheet1
Cell Formulas
RangeFormula
D2:D3,D8D2=TRANSPOSE(TEXTSPLIT(C2," "))
E2:E3,E8E2=SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2)
F2:F3,F8F2=--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2))
G2,G8G2=SUM(--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2)))
B2:B11B2=IF(0<>SUM(--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2))),A2,"N/A")
Dynamic array formulas.


If you go to the Formula tab, you can click on Evaluate Formula and step into it.

1689040567163.png
 
Upvote 1
Do these 2 examples with the step-by-step help?

Book6
ABCDEFG
1Data (column A)Formula (column B)Original Value (column C)Transpose portion of A2SearchIsnumberSum
2Apple Carrot OrangeApple Carrot OrangeOrange CarrotOrange1412
3Beet Tomato OnionBeet Tomato OnionTomatoCarrot71
4Pepper Banana GrapePepper Banana GrapeGrape Juice
5Lettuce Kale ChiaLettuce Kale ChiaKale Spinach Broccoli
6Apple Carrot OrangeApple Carrot OrangeOrange Carrot
7Beet Tomato OnionBeet Tomato OnionBeet JuiceTranspose for A8
8Pepper Banana GrapeN/AStrawberryStrawberry#VALUE!00
9Lettuce Kale ChiaLettuce Kale ChiaKale
10Apple Carrot OrangeApple Carrot OrangeOrange
11Beet Tomato OnionN/AJuice
Sheet1
Cell Formulas
RangeFormula
D2:D3,D8D2=TRANSPOSE(TEXTSPLIT(C2," "))
E2:E3,E8E2=SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2)
F2:F3,F8F2=--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2))
G2,G8G2=SUM(--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2)))
B2:B11B2=IF(0<>SUM(--ISNUMBER(SEARCH(TRANSPOSE(TEXTSPLIT(C2," ")),A2))),A2,"N/A")
Dynamic array formulas.


If you go to the Formula tab, you can click on Evaluate Formula and step into it.

View attachment 95015
very helpful thanks again. i'll work through it all. such a powerful formula.
 
Upvote 0
工作簿2
ABCD
1Data (column A)Formula (column B)Original Value (column C)Formula will produce:
2Apple Carrot OrangeApple Carrot OrangeOrange CarrotApple Carrot Orange
3Beet Tomato OnionBeet Tomato OnionTomatoBeet Tomato Onion
4Pepper Banana GrapePepper Banana GrapeGrape JuicePepper Banana Grape
5Lettuce Kale ChiaLettuce Kale ChiaKale Spinach BroccoliLettuce Kale Chia
6Apple Carrot OrangeApple Carrot OrangeOrange CarrotApple Carrot Orange
7Beet Tomato OnionBeet Tomato OnionBeet JuiceBeet Tomato Onion
8Pepper Banana Grape#N/AStrawberryN/A
9Lettuce Kale ChiaLettuce Kale ChiaKaleLettuce Kale Chia
10Apple Carrot OrangeApple Carrot OrangeOrangeApple Carrot Orange
11Beet Tomato Onion#N/AJuiceN/A
Sheet2
Cell Formulas
RangeFormula
B2:B11B2=IF(COUNT(FIND(TEXTSPLIT(C2," "),A2)),A2,NA())
 
Upvote 1
Sorry everyone. Really appreciate all the knowledge shared.
Looks like I made a big mistake - I neglected to mention that the rows do not match up directly.

Is there a way to have the formula search all throughout column A? And if there is a match, then it returns the respective value that it found in column A.

I tried changing the formula to:

…(C2,“ ”),A:A))),A:A,“N/A”)
But that clearly isn’t going to work.

Sorry again to make things complicated.

@kweaver
@Kevin_Li
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

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