Get Items From Descriptions Based on List

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
3,212
Office Version
  1. 365
Platform
  1. Windows
This is a summarized version of a table that is thousands of rows. I need to find the item from the Type List in Col N that is in the description in Column H. I only need one item per description. The list is ordered correctly.

The formula in Col I is not a solution because I keep having to add new items in the formula. The formula in Col J is good, but is there an easier way? It took me 45 minutes to figure it out and I know my client is going to complain that it's too complicated for them to maintain (which I don't get because the formula doesn't have to be changed, just the type list).

What would be your solution (Cell K3)

Why do these two formulas work in Column L? I'm using MINIFS in cell L2 to get the minimum value over 0. If I wrap the formula in Cell L3 with MINIFS, it doesn't work.
=LET(Ary,COUNTIF(H3,Crit)*SEQUENCE(COUNTA(TypeList)),MINIFS(Ary,Ary,">"&0))


Get Type of Item Sold for BCS.xlsm
HIJKLMNO
1ClunkyBetterBestQuestion
2DescriptionTypeTypeType2Type ListCrit List
3ACACAC??0WS*WS*
4Tools ACACAC2AC*AC*
5AC lampshadeACAC0CB*CB*
6Car parts with LED Lights ACACAC0TI*TI*
7CB Gold CoinCBCB
8Gold half ounce CBCBCB
9CBCBCB
10WSWSWS
11Arizona Coin Shop WS CBWSWS
12TI AC CB WSWSWS
13TI AC CBACAC
14TITITI
Sheet1
Cell Formulas
RangeFormula
I3:I14I3=IFS(COUNTIF(H3,"*WS*")>0,"WS",COUNTIF(H3,"*AC*")>0,"AC",COUNTIF(H3,"*CB*")>0,"CB",COUNTIF(H3,"*TI*")>0,"TI")
J3:J14J3=INDEX(TypeList,MIN(--SUBSTITUTE(COUNTIF(H3,Crit)*SEQUENCE(COUNTA(TypeList)),0,9999)))
L2L2=MINIFS(L3#,L3#,">"&0)
L3:L6L3=COUNTIF(H3,Crit)*SEQUENCE(COUNTA(TypeList))
O3:O6O3="*"&N3&"*"
Dynamic array formulas.
Named Ranges
NameRefers ToCells
Crit=Sheet1!$O$3:$O$6L3, J3:J14
TypeList=Sheet1!$N$3:$N$6L3, J3:J14, O3
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
One possibility :

K3: =INDEX(TypeList,MATCH(1,--ISNUMBER(SEARCH(" "&TypeList&" "," "&H3&" ")),))

I've assumed that the Type List characters will always be capitals (SEARCH is case sensitive), and that in the Descriptions, they will be space separated

You can wrap in IFERROR() if you'd like something other than #N/A if there is no match.
 
Upvote 0
SEARCH is case sensitive
Hi Stephen. I think that you have mixed up SEARCH & FIND features. 😎

@Jeffrey Mahoney
A couple more options. Col L formula is short but col M formula does not need to be copied down.

24 01 24.xlsm
HIJKLMOPQ
1ClunkyBetterStephenPeter 1Peter 2
2DescriptionTypeTypeTypeTypeTypeType ListCrit List
3ACACACACACACWS*WS*
4Tools ACACACACACACAC*AC*
5AC lampshadeACACACACACCB*CB*
6Car parts with LED Lights ACACACACACACTI*TI*
7CB Gold CoinCBCBCBCBCB
8Gold half ounce CBCBCBCBCBCB
9CBCBCBCBCBCB
10WSWSWSWSWSWS
11Arizona Coin Shop WS CBWSWSWSWSWS
12TI AC CB WSWSWSWSWSWS
13TI AC CBACACACACAC
14TITITITITITI
15some other text#N/A#REF!#N/A 
Lookup
Cell Formulas
RangeFormula
I3:I15I3=IFS(COUNTIF(H3,"*WS*")>0,"WS",COUNTIF(H3,"*AC*")>0,"AC",COUNTIF(H3,"*CB*")>0,"CB",COUNTIF(H3,"*TI*")>0,"TI")
J3:J15J3=INDEX(TypeList,MIN(--SUBSTITUTE(COUNTIF(H3,Crit)*SEQUENCE(COUNTA(TypeList)),0,9999)))
K3:K15K3=INDEX(TypeList,MATCH(1,--ISNUMBER(SEARCH(" "&TypeList&" "," "&H3&" ")),))
L3:L15L3=TAKE(FILTER(TypeList,COUNTIF(H3,Crit),""),1)
M3:M15M3=BYROW(H3:H15,LAMBDA(rw,TAKE(FILTER(TypeList,COUNTIF(rw,Crit),""),1)))
Q3:Q6Q3="*"&P3&"*"
Dynamic array formulas.
Named Ranges
NameRefers ToCells
Crit=Lookup!$Q$3:$Q$6M3, L3:L15, J3:J15
TypeList=Lookup!$P$3:$P$6M3, J3:L15, Q3
 
Last edited:
Upvote 0
Solution
Peter,

I like the formula in L3. It's clean and easy to read. I wonder why FILTER removes the zeroes without specifying it like: =TAKE(FILTER(TypeList,COUNTIF(H3,Crit)>0,""),1)

There's nothing stated in the materials from MS that state that.
FILTER function - Microsoft Support
 
Upvote 0
Zero is treated as False & any other number as True. This is true with a lot of functions, not just Filter
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,135
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