Worksheet Function

B

Brennan

Is there a worksheet function which will look into the contents of a cell,
find a value and return it?

Here is an example of what I am looking for:

Cell Return
Invoice No 1234 1234
Inv. No. 1235 1235
INum 1236 1236

As you can see, I am just looking for the invoice number even though they
may lable the "invoice no" differently.
 
G

Gary''s Student

Use this UDF:

Public Function ReturnNumerals(rng As Range) As String
Dim sStr As String, i As Long, sStr1 As String
Dim sChar As String
sStr = rng.Value
For i = 1 To Len(sStr)
sChar = Mid(sStr, i, 1)
If sChar Like "[0-9]" Then
sStr1 = sStr1 & sChar
End If
Next
ReturnNumerals = sStr1
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top