ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace #VALUE with 0 (https://www.excelbanter.com/excel-programming/374638-replace-value-0-a.html)

Lok Tak Cheong

Replace #VALUE with 0
 
I have set a formula as below, attempt to replace #VALUE for error with 0,
but it does not work, anyone can give me some hints?

Function evlookup(A, B, C)
D = WorksheetFunction.VLookup(A, B, C, False)
If WorksheetFunction.IsNA(D) = True Then
evlookup = 0
Else
evlookup = D
End If
End Function





Bob Phillips

Replace #VALUE with 0
 
Function evlookup(A, B, C)
On Error Resume Next
d = WorksheetFunction.VLookup(A, B, C, False)
On Error GoTo 0

If IsEmpty(d) Then
evlookup = 0
Else
evlookup = d
End If
End Function




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Lok Tak Cheong" wrote in message
...
I have set a formula as below, attempt to replace #VALUE for error with 0,
but it does not work, anyone can give me some hints?

Function evlookup(A, B, C)
D = WorksheetFunction.VLookup(A, B, C, False)
If WorksheetFunction.IsNA(D) = True Then
evlookup = 0
Else
evlookup = D
End If
End Function







PapaDos

Replace #VALUE with 0
 
Your call to VLookup generates an error and execution bumbs out of your
function.

Try this:

Function evlookup(A, B, C)
On Error Resume Next
evlookup = 0
evlookup = WorksheetFunction.VLookup(A, B, C, False)
On Error GoTo 0
End Function

--
Festina Lente


"Lok Tak Cheong" wrote:

I have set a formula as below, attempt to replace #VALUE for error with 0,
but it does not work, anyone can give me some hints?

Function evlookup(A, B, C)
D = WorksheetFunction.VLookup(A, B, C, False)
If WorksheetFunction.IsNA(D) = True Then
evlookup = 0
Else
evlookup = D
End If
End Function






Lok Tak Cheong

Replace #VALUE with 0
 
Dear Bob & PapaDos:
Thanks a lot!

"PapaDos" wrote in message
...
Your call to VLookup generates an error and execution bumbs out of your
function.

Try this:

Function evlookup(A, B, C)
On Error Resume Next
evlookup = 0
evlookup = WorksheetFunction.VLookup(A, B, C, False)
On Error GoTo 0
End Function

--
Festina Lente


"Lok Tak Cheong" wrote:

I have set a formula as below, attempt to replace #VALUE for error with
0,
but it does not work, anyone can give me some hints?

Function evlookup(A, B, C)
D = WorksheetFunction.VLookup(A, B, C, False)
If WorksheetFunction.IsNA(D) = True Then
evlookup = 0
Else
evlookup = D
End If
End Function








PapaDos

Replace #VALUE with 0
 
Bienvenue !
--
Festina Lente


"Lok Tak Cheong" wrote:

Dear Bob & PapaDos:
Thanks a lot!

"PapaDos" wrote in message
...
Your call to VLookup generates an error and execution bumbs out of your
function.

Try this:

Function evlookup(A, B, C)
On Error Resume Next
evlookup = 0
evlookup = WorksheetFunction.VLookup(A, B, C, False)
On Error GoTo 0
End Function

--
Festina Lente


"Lok Tak Cheong" wrote:

I have set a formula as below, attempt to replace #VALUE for error with
0,
but it does not work, anyone can give me some hints?

Function evlookup(A, B, C)
D = WorksheetFunction.VLookup(A, B, C, False)
If WorksheetFunction.IsNA(D) = True Then
evlookup = 0
Else
evlookup = D
End If
End Function










All times are GMT +1. The time now is 01:54 PM.

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