String pick up depending of certain values

ABC3132

New Member
Joined
Nov 7, 2017
Messages
48
Office Version
  1. 2019
Platform
  1. Windows
Hello.
I have the following question:

OriginalCaliber (mm)
Apple 10 mm
10​
12 mm Red Apple
12​
Green 15 mm Apple
15​

I would like to find a function where when the string "mm" is found I can pick te previous numbers up.
Any clue?
Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
The other guys do it better than me.

MrExcelPlayground20.xlsx
AB
2Apple 10 mm10
312 mm Red Apple12
4Green 15 mm Apple15
5The big green 14.5 mm apple14.5
Sheet25
Cell Formulas
RangeFormula
B2:B5B2=VALUE(MID(LEFT(A2,SEARCH(" mm",A2)-1),MAX(IFERROR(FIND(" ",LEFT(A2,SEARCH(" mm",A2)-1),ROW(INDIRECT("1:"&(LEN(LEFT(A2,SEARCH(" mm",A2)-1)))))),1)),99))
 
Upvote 0
Another option based on your example. James formula might be more robust than this one.

VBA Code:
IF(TEXTAFTER(TEXTBEFORE(A1,"mm")," ")="",TEXTBEFORE(A1,"mm"),TEXTAFTER(TEXTBEFORE(A1,"mm")," "))
 
Last edited:
Upvote 0
FYI - those text functions I think are not in 2019 version of excel , which is in profile - I think its only 365 version
BUT that is based on 2 websites i use/check
 
Upvote 0
The other guys do it better than me.

MrExcelPlayground20.xlsx
AB
2Apple 10 mm10
312 mm Red Apple12
4Green 15 mm Apple15
5The big green 14.5 mm apple14.5
Sheet25
Cell Formulas
RangeFormula
B2:B5B2=VALUE(MID(LEFT(A2,SEARCH(" mm",A2)-1),MAX(IFERROR(FIND(" ",LEFT(A2,SEARCH(" mm",A2)-1),ROW(INDIRECT("1:"&(LEN(LEFT(A2,SEARCH(" mm",A2)-1)))))),1)),99))
wow. Thanks JamesCanale!
 
Upvote 0
Another option based on your example. James formula might be more robust than this one.

VBA Code:
IF(TEXTAFTER(TEXTBEFORE(A1,"mm")," ")="",TEXTBEFORE(A1,"mm"),TEXTAFTER(TEXTBEFORE(A1,"mm")," "))
Unfortunately my Excel is corporative so the VBA are capped. Thanks anyway Coyotex3
 
Upvote 0
FYI - thats not VBA
its just a formula , using functions that exist in 365 version
just used the code tags on the forum
 
Upvote 0

Forum statistics

Threads
1,215,088
Messages
6,123,056
Members
449,091
Latest member
ikke

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