Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default vba function returns #name?

It's a simple function, so far:

Function Commission(Fee)
If Fee = 45 Then Commission = 15 Else Commission = Fee * 0.35
End Function

I've named my ranges and the function is in VBAProject | Modules.

I'm at a loss.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default vba function returns #name?

From the Excel help file (edited):
'--
The #NAME? error value occurs when Microsoft Excel doesn't recognize text in a formula.
Possible causes...
Deleting a name used in the formula, or using a name that does not exist.
Misspelling the name.
Misspelling the name of a function.
Entering text in a formula without enclosing the text in double quotation marks.
Omitting a colon (:) in a range reference.
'--
Also, the code should be in a standard/regular module and you might want it to
look more like this...

Function Commission(ByRef Fee As Variant) As Variant
If TypeName(Fee) < "Double" Then
Commission = "Bad Data"
ElseIf Fee <= 45 Then
Commission = 15
Else
Commission = Fee * 0.35
End If
End Function
--
Jim Cone
Portland, Oregon USA




"Rick"
wrote in message
It's a simple function, so far:

Function Commission(Fee)
If Fee = 45 Then Commission = 15 Else Commission = Fee * 0.35
End Function

I've named my ranges and the function is in VBAProject | Modules.
I'm at a loss.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF function returns function statement rather than result ckrogers Excel Worksheet Functions 3 April 16th 09 09:21 PM
Function returns #Name? jeremiah Excel Programming 5 December 16th 08 01:22 AM
INT Function Returns 1 bhavesh Excel Worksheet Functions 3 December 29th 06 02:48 PM
VBA function returns #NAME? mogens Excel Programming 4 March 20th 06 05:00 PM
Function returns a zero value Dick Kusleika Excel Programming 0 July 29th 03 05:01 PM


All times are GMT +1. The time now is 04:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"