HatchetHarry
New Member
- Joined
- Aug 20, 2018
- Messages
- 16
- Office Version
- 365
Hi there,
Coming back from my datas from yesterday and the help of Peter, I have 2 questions :
1st question :
My data :
B1 : Broad Spectrum SPF 15 - # Medium Beige 18g/0.6oz
B2 : Restructuring 1000ml/33.8oz
B3 : Treatment 118ml/4oz
B4 : Spectrum SPF 15 - # Medium 18g/0.6oz
I would like to extract "18g" OR "1000ml" in one formula.
For the moment I have these formulas working :
Basically, they take the word from the double space to the / and then format it to have a space between the num and text.
What I have :
A1 :
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(B1;FIND("/";B1)-1);" ";REPT(" ";20));20));"g";" g")
result : 18 g
A2 :
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(B2;FIND("/";B2)-1);" ";REPT(" ";20));20));"m";" m")
result : 1000 ml
etc...
Unfortunately, these formulas are independent.
What I would like to have a general formula that takes the 2 possibilities.
Something like :
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(B1;FIND("/";B1)-1);" ";REPT(" ";20));20));"m";" m" OR "g"; " g") - and of course doesn't make the formula crash if one of them isn't found.
2nd question
Still, with the same data.
In the case of this character "-" exists for B1 for example, I'm extracting the sentence from "-" to " " with this formula :
=LEFT(MID(B2;FIND("-";B2)+1;LEN(B2));FIND(" ";MID(B2;FIND("-";B2)+1;LEN(B2)))-1)
result : # Medium Beige
My final idea is to compile everything to have something like this :
A1 = # Medium Beige;18 g
A2 = 1000 ml
B3 = 118 ml
B4 = # Medium;18 g
For the record,
- There is always a "-" in front of the #
- There are always 2 spaces before the volume (ml or g)
- I can't split the results into different columns (formatted for API)
I know it's a bit complicated and I don't even know if it's possible this way (maybe with VBA ?)
If someone has a clue, I'll be glad to read it.
Thanks,
Harry
Coming back from my datas from yesterday and the help of Peter, I have 2 questions :
1st question :
My data :
B1 : Broad Spectrum SPF 15 - # Medium Beige 18g/0.6oz
B2 : Restructuring 1000ml/33.8oz
B3 : Treatment 118ml/4oz
B4 : Spectrum SPF 15 - # Medium 18g/0.6oz
I would like to extract "18g" OR "1000ml" in one formula.
For the moment I have these formulas working :
Basically, they take the word from the double space to the / and then format it to have a space between the num and text.
What I have :
A1 :
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(B1;FIND("/";B1)-1);" ";REPT(" ";20));20));"g";" g")
result : 18 g
A2 :
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(B2;FIND("/";B2)-1);" ";REPT(" ";20));20));"m";" m")
result : 1000 ml
etc...
Unfortunately, these formulas are independent.
What I would like to have a general formula that takes the 2 possibilities.
Something like :
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(B1;FIND("/";B1)-1);" ";REPT(" ";20));20));"m";" m" OR "g"; " g") - and of course doesn't make the formula crash if one of them isn't found.
2nd question
Still, with the same data.
In the case of this character "-" exists for B1 for example, I'm extracting the sentence from "-" to " " with this formula :
=LEFT(MID(B2;FIND("-";B2)+1;LEN(B2));FIND(" ";MID(B2;FIND("-";B2)+1;LEN(B2)))-1)
result : # Medium Beige
My final idea is to compile everything to have something like this :
A1 = # Medium Beige;18 g
A2 = 1000 ml
B3 = 118 ml
B4 = # Medium;18 g
For the record,
- There is always a "-" in front of the #
- There are always 2 spaces before the volume (ml or g)
- I can't split the results into different columns (formatted for API)
I know it's a bit complicated and I don't even know if it's possible this way (maybe with VBA ?)
If someone has a clue, I'll be glad to read it.
Thanks,
Harry