Avoid Repetition/Mismatch in TEXTJOIN of Cell Contents and a Named Range

rfhandel

New Member
Joined
Nov 26, 2024
Messages
9
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Sorry for my ignorance in formulas. I use what I can beg, borrow, or steal, but I do not do a very good job of figuring them out on my own.

I am trying to extract metadata from a cell that is specifically relevant to various media used in an image. Each metadata term is separated by a delimiter (i.e. ";").

I have managed to use a TEXTJOIN formula to extract the data from a named range as demonstrated in the formula and screenshot below, with delimiters dividing the extracted text;
=TEXTJOIN(",",TRUE,IF(ISNUMBER(FIND(Table15[Media],D4)),MID(D4,FIND(Table15[Media],D4),LEN(Table15[Media])),""))
however, as indicated by the highlighted text below, the formula also extracts text that is not an exact match from the delimited text to the data entered in the named range (i.e. Acrylic AND Acrylic Gouache vs just Acrylic Gouache). How can I get the formula to read an exact match to the cells in the named range with the text from the target cell.

Secondly, but of less importance, how could I add a conjunction (i.e. "and") to the last extracted term in addition to or replacing the comma delimiter?
1732681939831.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Array Formula.xlsx
DEFGH
1
2Acrylic; Canvas; Dry Pigment; Face(s); Grass; Leaves; Media; Nature; Painting; Roots; Silver leaf gilding; Sulphur oxidized patina; Theme; Woman; Woman(en)Acrylic, Dry Pigment, Silver leaf gilding, Sulphur oxidized patinaTEXTJOIN(", ",TRUE,IF(ISNUMBER(FIND(Table15[Media],D2)),MID(D2,FIND(Table15[Media],D2),LEN(Table15[Media])),""))
3 
4Acrylic Gouache; Angel; Fiber board; Flower; Media; Music; Painting; Theme; TrumpetAcrylic Gouache, AcrylicTEXTJOIN(", ",TRUE,IF(ISNUMBER(FIND(Table15[Media],D4)),MID(D4,FIND(Table15[Media],D4),LEN(Table15[Media])),""))
5
6Media
724k Gold & Silver leaf gilding
824k Gold leaf gilding
9Acrylic Gouache
10Acrylic
11Dry Pigment
12Gansai Watercolor
13Silver leaf gilding
14Sulphur oxidized patina
15Sumi ink
16Kakushibu (persimmon tannin)
17Washi paper
18Collage
19
Sheet2
Cell Formulas
RangeFormula
F2:F4F2=TEXTJOIN(", ",TRUE,IF(ISNUMBER(FIND(Table15[Media],D2)),MID(D2,FIND(Table15[Media],D2),LEN(Table15[Media])),""))
 
Upvote 0
Try:
Excel Formula:
=LET(t,TEXTSPLIT(D2,,"; "),TEXTJOIN(", ",,FILTER(t,ISNUMBER(XMATCH(t,Table15[Media])))))
 
Upvote 0
How about
Excel Formula:
=TEXTJOIN("; ",,FILTER(Table15[Media],ISNUMBER(XMATCH(Table15,TEXTSPLIT(D2,"; ")))))
 
Upvote 0
Try:
Excel Formula:
=LET(t,TEXTSPLIT(D2,,"; "),TEXTJOIN(", ",,FILTER(t,ISNUMBER(XMATCH(t,Table15[Media])))))
I am a little less clear on how this one works, but it indeed works. Thank you! Any possibility on how I can replace the comma delimiter with "and" for the last two extracted terms (i.e. "Acrylic, Dry Pigment, Silver leaf gilding and Sulphur oxidized patina)
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER(Table15[Media],ISNUMBER(XMATCH(Table15,TEXTSPLIT(D4,"; ")))),IF(ROWS(f)=1,f,TEXTJOIN(", ",,DROP(f,-1))&" and "&TAKE(f,-1)))
 
Upvote 0
Solution
How about
Excel Formula:
=TEXTJOIN("; ",,FILTER(Table15[Media],ISNUMBER(XMATCH(Table15,TEXTSPLIT(D2,"; ")))))
This one works equally as well, and I am almost clear on how it works. Same question, however: any clue on how to replace the last comma delimiter with "and" with the extracted text (i.e. "Acrylic, Dry Pigment, Silver leaf gilding and Sulphur oxidized patina")
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER(Table15[Media],ISNUMBER(XMATCH(Table15,TEXTSPLIT(D4,"; ")))),IF(ROWS(f)=1,f,TEXTJOIN(", ",,DROP(f,-1))&" and "&TAKE(f,-1)))
Perfect!!! Thank you so much! I am so thankful I discovered this forum; you all have already saved me hours of research and work!
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,151
Members
452,891
Latest member
JUSTOUTOFMYREACH

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