Simplifying a formula

hnt007

Board Regular
Joined
Dec 18, 2021
Messages
98
Office Version
  1. 365
Platform
  1. MacOS
Hello and thanks for your help!

Is there a way to simplify this formula? =COUNTIF(C4,"*"&LEFT(C3,(FIND(" ",C3,1)-1))&"*")+COUNTIF(C4,"*"&MID(C3,FIND(" ",C3)+1,FIND(" ",C3,FIND(" ",C3)+1)-FIND(" ",C3))&"*")+COUNTIF(C4,"*"&TRIM(MID(SUBSTITUTE(C3," ",REPT(" ",100)),200,100))&"*")+COUNTIF(C4,"*"&TRIM(MID(SUBSTITUTE(C3, " ", REPT(" ", 999)), 2999, 999))&"*")+COUNTIF(C4,"*"&RIGHT(C3,LEN(C3)-FIND("~",SUBSTITUTE(C3," ","~",4)))&"*")>0

I need a smaller version of it to put in Conditional Formatting.

Track descriptions will all be different and I will never know what instruments are listed in advance, so that's why I'm using formulas to extract them. Here is the file Loading Google Sheets

Screen Shot 2022-05-16 at 8.32.14 PM.png
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Are cell C3 to C9 helpers?
Also, is C11 helper and do you want to hightlight cell C2?
 
Upvote 0
Just a quick look - I haven't tried to deconstruct your formula - but I'm guessing you're doing this?

ABCDEF
1
2Blagh blah blah trumpet blah version piano blah gtr
3
4trumpet17
5piano38
6gtr49
7
8Version30
9
10TRUE
Sheet1
Cell Formulas
RangeFormula
C4:C6C4=SEARCH(B4:B6,B2)
C8C8=SEARCH(B8,B2)
C10C10=MIN(SEARCH(B4:B6,B2))<SEARCH("Version",B2)
Dynamic array formulas.
 
Upvote 0
Are cell C3 to C9 helpers?
Also, is C11 helper and do you want to hightlight cell C2?
These are meant to show how I'm trying to come up with my final formula in C11. Yes, once I have this unique formula, I'll put it in Conditional Formatting for C2. Thanks!!
 
Upvote 0
Just a quick look - I haven't tried to deconstruct your formula - but I'm guessing you're doing this?

ABCDEF
1
2Blagh blah blah trumpet blah version piano blah gtr
3
4trumpet17
5piano38
6gtr49
7
8Version30
9
10TRUE
Sheet1
Cell Formulas
RangeFormula
C4:C6C4=SEARCH(B4:B6,B2)
C8C8=SEARCH(B8,B2)
C10C10=MIN(SEARCH(B4:B6,B2))<SEARCH("Version",B2)
Dynamic array formulas.
Thanks for helping! Well, I won't be able to write down instruments, I'll need formulas to extract them from the track descriptions that I will receive, I won't be able to use any cells in that XL to add formulas, so I need to find 1 formula that will do all the work and that I will put in Conditional Formatting.
 
Upvote 0
Just a quick look ...
I'll need formulas to extract them from the track descriptions ....

Yes, too quick, sorry.

I can do it like this:

AB
1
2Blah blah blah trumpet blah version - no trumpet piano gtr
3Blah blah blah blah version - no trumpet piano gtr
4Blah blah blah piano blah blah version - no trumpet piano gtr
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B4Expression=LET(s,SEARCH("Version - no",B2),MIN(SEARCH(FILTERXML("<x><y>"&SUBSTITUTE(RIGHT(B2,LEN(B2)-s-12)," ","</y><y>")&"</y></x>","//y"),B2))<s)textNO

But if you're restricted to MacOS you won't have FILTERXML. Perhaps you do have the new TEXTSPLIT function, which we could use instead of FILTERXML?
 
Upvote 0
Yes, too quick, sorry.

I can do it like this:

AB
1
2Blah blah blah trumpet blah version - no trumpet piano gtr
3Blah blah blah blah version - no trumpet piano gtr
4Blah blah blah piano blah blah version - no trumpet piano gtr
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B4Expression=LET(s,SEARCH("Version - no",B2),MIN(SEARCH(FILTERXML("<x><y>"&SUBSTITUTE(RIGHT(B2,LEN(B2)-s-12)," ","</y><y>")&"</y></x>","//y"),B2))<s)textNO

But if you're restricted to MacOS you won't have FILTERXML. Perhaps you do have the new TEXTSPLIT function, which we could use instead of FILTERXML?
WOW this looks perfect! But yes, I'm on macOS and I don't have this formula available to me yet...
 
Upvote 0
We could do the TEXTSPLIT part another way ....

AB
1
2Blah blah blah trumpet blah version - no trumpet piano gtr
3
4trumpet
5piano
6gtr
Sheet3
Cell Formulas
RangeFormula
B4:B6B4=LET(f,SEARCH("Version - no",B2),s,RIGHT(B2,LEN(B2)-f-12),m,MySplit(" "&s," ",99),MID(s,m,MySplit(s&" "," ",99)-m))
Dynamic array formulas.

MySplit: =LAMBDA(s,del,N,LET(MyDel,"@|^",f,FIND(MyDel,SUBSTITUTE(s,del,MyDel,SEQUENCE(N))),FILTER(f,ISNUMBER(f))))

This is just a first cut - it could be tidied up into the one LAMBDA. See if you can make it work?

I'll wait for the 14 new Text and Array functions.
 
Upvote 0

Forum statistics

Threads
1,215,302
Messages
6,124,148
Members
449,146
Latest member
el_gazar

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