Return for each cell in a range the portion matching a list of string

ED38

New Member
Joined
Mar 29, 2024
Messages
26
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to build a formula doing the following :
For each cell in the range T2:T38 containing a text string if it includes one of the sub-string listed in the range U2:U12 then show the matching sub-string in a spilled formula as show in column V :
I found a way to do it on ONE cell (my formula in Y2 but I would need a spilled version of a similar formula... ;-) )

2024-08-29 SKU Report - Cat code Recommendation.xlsm
TUVWXY
1DataString to searchexpected resultsCommentmy Try but works only on a single cell not for the array from T2:T38
2ON_PREMISE_SUBSUBSUBSUB
3SAAS_WO_CONSSAASCONS
4EXTSUPP_PLUSSUPPSUPP
5ON_PREMISE_EVALEVALEVAL
6PS_PACKAGEDPSPS
7ON_PREMISE_PERPPERPPERP
8ELA_SUPPORT_SUMMARYOTHERSUPP
9ELA_LICENSE_SUMMARYCONSnothing
10FOUNDATION_SUPPORTHWSUPP
11ADVSUPP_WO_CONSEDUSUPPbecause SUPP appears before CONS
12ON_PREMISE_CONS_PPUTERMCONS
13SAAS_FLEXSAAS
14SAAS_PACKAGEDSAAS
15SAAS_W_CONSSAAS
16SAAS_EVALSAAS
17SAAS_BILL_ONLYSAAS
18INCIDENT_PACKnothing
19HW_SALESnothing
20PS_CUSTOMPS
21PS_TIME_AND_EXPENSESPS
22ON_PREMISE_BILL_ONLYnothing
23EDU_CUSTOMEDU
24ON_PREMISE_SUB_ACASUB
25EDU_SERVICES
26ON_PREMISE_TERM_FIXED
27ON_PREMISE_TERM
28CUSTOM_SUPPORT
29EDU_ONDEMAND_TRAINING
30ON_PREMISE_SUB_CONTENT
31EDU_TIME_AND_EXPENSE
32SUPP_BILL_ONLY
33ON_PREMISE_OPENS
34ON_PREMISE_LIC_EXT
35SAAS_CUSTOM
36SAAS_TIME_AND_EXPENSE
37CREDITS
38RTS
report1701769401652
Cell Formulas
RangeFormula
Y2Y2=@OFFSET($U$1,SUMPRODUCT((COUNTIF(T2,"*"&$U$2:$U$12&"*"))*(ROW(U2:U12)-ROW($U$2)+1)),0,,)


Thanks for any idea if you can help
 
Just for fun... another option:

Book1
ABCDEF
1DataString to searchexpected resultsFormulaFormula 2
2ON_PREMISE_SUBSUBSUBSUBSUB
3SAAS_WO_CONSSAASCONSSAAS, CONSSAASCONS
4EXTSUPP_PLUSSUPPSUPPSUPPSUPP
5ON_PREMISE_EVALEVALEVALEVALEVAL
6PS_PACKAGEDPSPSPSPS
7ON_PREMISE_PERPPERPPERPPERPPERP
8ELA_SUPPORT_SUMMARYOTHERSUPPSUPPSUPP
9ELA_LICENSE_SUMMARYCONS
10FOUNDATION_SUPPORTHWSUPPSUPPSUPP
11ADVSUPP_WO_CONSEDUSUPPSUPP, CONSSUPPCONS
12ON_PREMISE_CONS_PPUTERMCONSCONSCONS
13SAAS_FLEXSAASSAASSAAS
14SAAS_PACKAGEDSAASSAASSAAS
15SAAS_W_CONSSAASSAAS, CONSSAASCONS
16SAAS_EVALSAASSAAS, EVALSAASEVAL
17SAAS_BILL_ONLYSAASSAASSAAS
18INCIDENT_PACK
19HW_SALESHWHW
20PS_CUSTOMPSPSPS
21PS_TIME_AND_EXPENSESPSPSPS
22ON_PREMISE_BILL_ONLY
23EDU_CUSTOMEDUEDUEDU
24ON_PREMISE_SUB_ACASUBSUBSUB
25EDU_SERVICESEDUEDU
26ON_PREMISE_TERM_FIXEDTERMTERM
27ON_PREMISE_TERMTERMTERM
28CUSTOM_SUPPORTSUPPSUPP
29EDU_ONDEMAND_TRAININGEDUEDU
30ON_PREMISE_SUB_CONTENTSUBSUB
31EDU_TIME_AND_EXPENSEEDUEDU
32SUPP_BILL_ONLYSUPPSUPP
33ON_PREMISE_OPENS
34ON_PREMISE_LIC_EXT
35SAAS_CUSTOMSAASSAAS
36SAAS_TIME_AND_EXPENSESAASSAAS
37CREDITS
38RTS
Sheet1
Cell Formulas
RangeFormula
D2:D38D2=LET(d,A2:A38, ss,B2:B12, DROP(REDUCE("",d,LAMBDA(arr,newItem, VSTACK(arr, IFERROR(TEXTJOIN(", ", 1,FILTER(ss, ISNUMBER(SEARCH(ss, newItem)))), "")))), 1) )
E2:F38E2=LET(d,A2:A38, ss,B2:B12, IFERROR(DROP(REDUCE("",d,LAMBDA(arr,newItem, VSTACK(arr, IFERROR(TOROW(FILTER(ss, ISNUMBER(SEARCH(ss, newItem)))), "")))), 1), "") )
Dynamic array formulas.
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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