Extract Data Between Symbols Depending on Situation

Stevan Premovic

New Member
Joined
May 11, 2018
Messages
11
I've been trying to write a formula that will extract the number after the @ symbol in a number of situations, but everything I've come up with thus far won't work for every case.

Lets say in cells A1:A5 I have:

[BALL VALVE,-RF,CL600 @ 4, 10XAH007]
[BALL VALVE,-RF,CL600,SPINDLE ELONGATION @ 4; 10XAH011]
[GATE VALVE,-RF,CL600 @ .5]
[GLOBE VALVE,-RF,CL600 @ .75]
[AXIAL CHECK VALVE@ 6,-RF, CL300, 21XAE501

What I'm trying to extract is 4, 4, .5, .75 and 6, respectively.

What I initially started with was to extract a certain number of characters to the right of the @ symbol, but that left me with additional commas, and in some cases some symbols.

Any help would be greatly appreciated
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
One option, using a UDF
Code:
Function GetNum(Rng As Range, Optional delim As String) As Double
   GetNum = Split(Split(Rng, "@")(1), delim)(0)
End Function
and use like =GetNum(F6,",") where the part in red is the delimiter after the number
 
Upvote 0
Hi,

Here's a formula solution also:


Book1
ABC
1[BALL VALVE,-RF,CL600 @ 4, 10XAH007]44
2[BALL VALVE,-RF,CL600,SPINDLE ELONGATION @ 4; 10XAH011]44
3[GATE VALVE,-RF,CL600 @ .5]0.5.5
4[GLOBE VALVE,-RF,CL600 @ .75]0.75.75
5[AXIAL CHECK VALVE@ 6,-RF, CL300, 21XAE50166
Sheet60
Cell Formulas
RangeFormula
B1=LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(MID(A1,FIND("@",A1)+1,255)),";",","),"]",","),",",REPT(" ",30)),15)+0
C1=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(MID(A1,FIND("@",A1)+1,255)),";",","),"]",","),",",REPT(" ",30)),15))


Use C1 formula if you just want the number string extracted, results will be TEXT, exactly as show in original data string.
Use B1 formula if you want the results converted to Real Numbers for further math.

Either way, formulas copied down.
 
Upvote 0
One option, using a UDF
Code:
Function GetNum(Rng As Range, Optional delim As String) As Double
   GetNum = Split(Split(Rng, "@")(1), delim)(0)
End Function
and use like =GetNum(F6,",") where the part in red is the delimiter after the number

Another possibility without needing to know the delimiter...
Code:
Function GetNum(S As String) As Double
  GetNum = Val(Split(S, "@")(1))
End Function
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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