ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Numeric data (https://www.excelbanter.com/excel-programming/410687-numeric-data.html)

Ams

Numeric data
 
Dear all

Pleasae guide me to find out numeric data in cell where the cell
contains both aplha & numeric value.

Like i want to take out pincode from one single cell where in the
location and pincode is mentioned in a single cell

Eg ( Mumbai 400018 )

Serch Result shud b 400018


Thanxs in advance

Rick Rothstein \(MVP - VB\)[_1881_]

Numeric data
 
Are pin codes always 6 digits long? If so...

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456 789")),6)

If not, you will have to give us several examples so we can see if any
patterns exist (for example, number always at the end of the text, or number
is always followed by a space, and so on). By the way, it is not clear from
your example if your text is surrounded by parentheses or not.

Rick


"Ams" wrote in message
...
Dear all

Pleasae guide me to find out numeric data in cell where the cell
contains both aplha & numeric value.

Like i want to take out pincode from one single cell where in the
location and pincode is mentioned in a single cell

Eg ( Mumbai 400018 )

Serch Result shud b 400018


Thanxs in advance



atpgroups

Numeric data
 
On 9 May, 10:11, Ams wrote:
Pleasae guide me to find out numeric data in cell where the cell
contains both aplha & numeric value.


Sounds like a job for the Split function

Function GetNumeric(S as string)
Dim i as Integer
Dim Lumps as Variant
Lumps = Split(S," ") ' or delimiter of your choice, but your example
used a space
For i = 0 to Ubound Lumps
If Isnumeric(Lumps(i)) then ' found a number
GetNumeric = Val(Lumps(i))
Exit Function
End If
Next
' If we get here, there wasn't one
GetNumeric = "<Invalid Data"
End Function


All times are GMT +1. The time now is 09:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com