Combine formulas

HatchetHarry

New Member
Joined
Aug 20, 2018
Messages
16
Office Version
  1. 365
Hello there,

I have a formula which extract a specific word from a cell and I could succeed :

=LEFT(MID(K2;FIND(" ";K2)+1;LEN(K2));FIND("/";MID(K2;FIND(" ";K2)+1;LEN(K2)))-1)

The result is "100ml"

After, my goal was to separate "100" and "ml" to make "100 ml" and I could also succeed with this formula :

=TRIM(REPLACE(A2;MIN(FIND("m";A2&"m"));0;" "))

Now I'm struggling a bit to find a way to put everything in ONE formula.

Any ideas ?

Thank you,
Harry
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
If you supply the original data there may be a better way

=TRIM(REPLACE(LEFT(MID(K2;FIND(" ";K2)+1;LEN(K2));FIND("/";MID(K2;FIND(" ";K2)+1;LEN(K2)))-1);MIN(FIND("m";LEFT(MID(K2;FIND(" ";K2)+1;LEN(K2));FIND("/";MID(K2;FIND(" ";K2)+1;LEN(K2)))-1)&"m"));0;" "))

Will it always be ml in the data ?
 
Last edited:
Upvote 0
Hello Special-K99,

Thanks for your reply.
Unfortunately it doesn't work like I want.

Here are the data :

B2 : Water Mineral 100ml/3.4oz
A2 : =LEFT(MID(B2;FIND(" ";B2)+1;LEN(B2));FIND("/";MID(B2;FIND(" ";B2)+1;LEN(B2)))-1)
A3 : =TRIM(REPLACE(A2;MIN(FIND("m";A2&"m"));0;" "))
 
Upvote 0
Welcome to the MrExcel board!

Does this do what you want (after you replace "," with ";" for your Excel version)?
If not, please give some more varied sample data (say 5-6 rows) and expected results.

=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(B2,FIND("/",B2)-1)," ",REPT(" ",20)),20)),"m"," m")
 
Last edited:
Upvote 0
I have a formula which extract a specific word from a cell and I could succeed :

=LEFT(MID(K2;FIND(" ";K2)+1;LEN(K2));FIND("/";MID(K2;FIND(" ";K2)+1;LEN(K2)))-1)

The result is "100ml"

No it's not.
Not given the data you supplied.

"Water Mineral 100ml/3.4oz"

results in "Mineral 100ml"
 
Upvote 0
Genius Peter !
Thanks a lot ! Please if you have time can you explain me quickly how you came out with this formula ?

No it's not.
Not given the data you supplied.

"Water Mineral 100ml/3.4oz"

results in "Mineral 100ml"

It does work for me...

Thanks anyway !
 
Upvote 0
Thanks a lot ! Please if you have time can you explain me quickly how you came out with this formula ?
Working from the inside of the formula outwards ..
Extract the part to the left of the "/" with FIND and LEFT
Replace all the spaces with 20 spaces so the "words" are well spread out
Take the 20 characters at the right. This will get the 100ml with quite few leading spaces
TRIM removes the leading spaces
Replace (substitute) the "m" with " m" to introduce the required separation


It does work for me...
The point Special-K99 was making was that if the text is
Water Mineral 100ml/3.4oz
The formula you first posted returns "Mineral 100ml" not "100ml" as you stated.
Here it is:


Book1
KL
2Water Mineral 100ml/3.4ozMineral 100ml
Sheet5
Cell Formulas
RangeFormula
L2=LEFT(MID(K2,FIND(" ",K2)+1,LEN(K2)),FIND("/",MID(K2,FIND(" ",K2)+1,LEN(K2)))-1)
 
Upvote 0
[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]L2[/TH]
[TD="align: left"]=LEFT(MID(K2,FIND(" ",K2)+1,LEN(K2)),FIND("/",MID(K2,FIND(" ",K2)+1,LEN(K2)))-1)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

During my copy paste one space has been removed from "Water Mineral 100ml/3.4oz" between the "l" and the "1" and my formula =LEFT(MID(K2,FIND(" ",K2) takes 2 spaces in argument.

Thank you very much both of you for your help,
Harry
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
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