split 1.5/2.1 into 1.5 and 2.1

  • Thread starter Thread starter Okieviking
  • Start date Start date
O

Okieviking

I have a cell with numbers in the following format 1.5/2.1. Is there a way
of picking the numbers out of that so I can populate two cells with 1.5 and
2.1?
 
'VBA
strData = "1.5/2.1"
Range("B1") = Split(strData,"/")(0)
Range("C1") = Split(strData,"/")(1)

'Worksheetfunction
=LEFT(A1,Find("/",A1)-1)
=MID(A1,Find("/",A1)+1,len(A1))


If this post helps click Yes
 
'VBA
strData = "1.5/2.1"
Range("B1") = Split(strData,"/")(0)
Range("C1") = Split(strData,"/")(1)

Or, since we are going across columns, more simply...

strData = "1.5/2.1"
Range("B1:C1") = Split(strData, "/")

Note to the OP... Jacob (and I) used a String variable (strData) to hold
your values, but this value can come directly from a cell as well... just
replace strData with Range("A1") assuming your cell is A1, of course.
 
Back
Top