can't get a formula that"s supposed to only return the numbers in a cell to work

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
784
Office Version
  1. 365
Platform
  1. Windows
Hi
I’m using excel 365

B2:B153 is a list of numbers
E3 is a result of a VLOOKUP using the B2:B153 and what is in E1

In E5 I have the following to give me where the number in E3 came from
Excel Formula:
=CELL("address",INDEX($B$2:$B$153,MATCH(E3,$B$2:$B$153,1)))
I then tried to use this in F5, and I got #NAME?
Excel Formula:
=IF(E5="","",onlynums(E5))
I tried a different formula and still get #NAME?
Excel Formula:
=@IF(E5="","",StripChars(E5))
I then tried the two by entering the cell address without the >>=cell(…

And got the same results.

What Am I missing



Mike
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I believe "onlynums" and "StripChars" are probably custom user defined functions (UDF) that someone created.
So you would have to get the VBA code for that function and put it in your workbook in order to use it.
 
Upvote 0
Solution
Guess:
MrExcelPlayground6.xlsx
BCDE
14
21
324
43
54$B$5
65
76
87
98
109
1110
Sheet8
Cell Formulas
RangeFormula
E3E3=VLOOKUP(E1,B2:B11,1,0)
E5E5=CELL("address",OFFSET(B1,MATCH(E1,B2:B11,0),0))
 
Upvote 0
Yep it is a UDF
After I saw your reply, I went thru all the modulars in the workbook that I found the formula in and found it.
I don't remember where I got it from. >>> old differently affects memory
In case anyone is looking for it after seeing this post, here it is.
VBA Code:
Function OnlyNums(sWord As String)      
    Dim sChar As String
    Dim x As Integer
    Dim sTemp As String
    sTemp = ""
    For x = 1 To Len(sWord)
        sChar = Mid(sWord, x, 1)
        If Asc(sChar) >= 48 And _
          Asc(sChar) <= 57 Then
            sTemp = sTemp & sChar
        End If
    Next
OnlyNums = Val(sTemp)
End Function
and
VBA Code:
Function StripChar(aText As String)  
    Dim I As Integer
    StripChar = ""
    For I = 1 To Len(aText)
        aChar = Mid(aText, I, 1)
        Select Case aChar
            Case "0" To "9"
                StripChar = StripChar & aChar
        End Select
    Next
End Function
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

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