Count after finding a Word within a Cell

RedDodger78

New Member
Joined
Feb 26, 2019
Messages
3
Hi,

I am hoping that someone can help to find a solution.

In the example text below, what I trying to do is find the words: Bas, Maj & Repair, when I do this using the formula below it returns the number of times that the word appears, however, what I really need to do is to count the number of items between the dash and the semi-colon after the word and to return that number for each instance.

Example text:

[TABLE="width: 575"]
<tbody>[TR]
[TD="class: xl63, width: 575"]BAS - PROT; MAJ - CAB: MAJ - X301; BAS - X228, X303, X324, CT, VT; MAJ - X201C, X201D, X201E; MAJ - X201A, X201B; BAS - X128, CT, PROT; REPAIR - X143G4, X143G2; MAJ - 1SE, 1SH; BAS - X120, X124, VT, PROT; BAS - PROT;[/TD]
[/TR]
</tbody>[/TABLE]

I am using the following formula to count the number of words within a cell:

=SUMPRODUCT((LEN($A1)-LEN(SUBSTITUTE((UPPER($A1)),UPPER("Bas"),"")))/LEN("Bas"))

[TABLE="width: 128"]
<tbody>[TR]
[TD="width: 64"]BAS =[/TD]
[TD="class: xl65, width: 64"]5[/TD]
[/TR]
[TR]
[TD]MAJ =[/TD]
[TD="class: xl65, width: 64"]5[/TD]
[/TR]
[TR]
[TD]Repair =[/TD]
[TD="class: xl65, width: 64"]1[/TD]
[/TR]
</tbody>[/TABLE]

What I would really like to do is to count the number of items that are after this word and between the dash and the semi-colon so I end up with:

[TABLE="width: 192"]
<tbody>[TR]
[TD="width: 64"]BAS =[/TD]
[TD="class: xl65, width: 64"]14[/TD]
[TD="class: xl66, width: 64"][/TD]
[/TR]
[TR]
[TD]MAJ =[/TD]
[TD="class: xl65, width: 64"]8[/TD]
[TD="class: xl66"][/TD]
[/TR]
[TR]
[TD]Repair =[/TD]
[TD="class: xl65, width: 64"]2[/TD]
[TD="class: xl66"][/TD]
[/TR]
</tbody>[/TABLE]

I am hoping that this is possible as I have around 4,000+ cells that I am trying to analyse on a regular basis, and doing this manually is very time consuming!

Thank you in advance for any support :)
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi,

For so many cells... 4'000 + ... why not creating a customized UDF ...?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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