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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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
Worksheet Formulas
CellFormula
L2=LEFT(MID(K2,FIND(" ",K2)+1,LEN(K2)),FIND("/",MID(K2,FIND(" ",K2)+1,LEN(K2)))-1)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

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,215,516
Messages
6,125,285
Members
449,218
Latest member
Excel Master

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