ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can I creat userdefine function (https://www.excelbanter.com/excel-worksheet-functions/167112-how-can-i-creat-userdefine-function.html)

Montu

How can I creat userdefine function
 
I want convert number into word in excel 2003, for this reason wanted support
from microsoft help & support site. They suggest me creat user define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click OK.
5. Enter the number or cell reference that you want, and then click OK.
But problem is in the select a function list under User Defined category,
there is no SpellNumber to click. How do I creat new function (SpellNumber)
name ? Help me.

David Biddulph[_2_]

How can I creat userdefine function
 
Try following the instructions at http://support.microsoft.com/kb/213360

The part of the instructions that you quoted below are one of the methods
for *using* the UDF. Have you been through the earlier stage of the
instructions, for *creating* the UDF?
--
David Biddulph

"Montu" wrote in message
...
I want convert number into word in excel 2003, for this reason wanted
support
from microsoft help & support site. They suggest me creat user define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click OK.
5. Enter the number or cell reference that you want, and then click OK.
But problem is in the select a function list under User Defined category,
there is no SpellNumber to click. How do I creat new function
(SpellNumber)
name ? Help me.




Gary''s Student

How can I creat userdefine function
 
You can use:
=CHOOSE(A1+1,"zero","one","two","three","four","fi ve","six","seven","eight","nine")
for a simple integer. For more complex numbers:

XL2000: How to Convert a Numeric Value into English Words
http://support.microsoft.com/default...N-US;Q213360&;


--
Gary''s Student - gsnu200758


"Montu" wrote:

I want convert number into word in excel 2003, for this reason wanted support
from microsoft help & support site. They suggest me creat user define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click OK.
5. Enter the number or cell reference that you want, and then click OK.
But problem is in the select a function list under User Defined category,
there is no SpellNumber to click. How do I creat new function (SpellNumber)
name ? Help me.


Montu

How can I creat userdefine function
 
Yes, I have been go through the earlier stage of the instruction (Method 1,2,
& 3), I have applied Method 1 & 2 but no result, & 3 I just tried to Insert
function, because I have not been using Excel 2000 or Excel 2002. So what's
wrong with me.

"David Biddulph" wrote:

Try following the instructions at http://support.microsoft.com/kb/213360

The part of the instructions that you quoted below are one of the methods
for *using* the UDF. Have you been through the earlier stage of the
instructions, for *creating* the UDF?
--
David Biddulph

"Montu" wrote in message
...
I want convert number into word in excel 2003, for this reason wanted
support
from microsoft help & support site. They suggest me creat user define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click OK.
5. Enter the number or cell reference that you want, and then click OK.
But problem is in the select a function list under User Defined category,
there is no SpellNumber to click. How do I creat new function
(SpellNumber)
name ? Help me.





David Biddulph[_2_]

How can I creat userdefine function
 
Read it again, please. Method 1, Method 2, and Method 3 are the 3 suggested
alternatives of ways of *using* the UDF.
Before you do that you need to go through the stage of *creating* the UDF.
That part is headed "How to create the sample function Called SpellNumber".
--
David Biddulph
Rowing web pages at
http://www.biddulph.org.uk/

"Montu" wrote in message
...
Yes, I have been go through the earlier stage of the instruction (Method
1,2,
& 3), I have applied Method 1 & 2 but no result, & 3 I just tried to
Insert
function, because I have not been using Excel 2000 or Excel 2002. So
what's
wrong with me.

"David Biddulph" wrote:

Try following the instructions at http://support.microsoft.com/kb/213360

The part of the instructions that you quoted below are one of the methods
for *using* the UDF. Have you been through the earlier stage of the
instructions, for *creating* the UDF?
--
David Biddulph

"Montu" wrote in message
...
I want convert number into word in excel 2003, for this reason wanted
support
from microsoft help & support site. They suggest me creat user define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click OK.
5. Enter the number or cell reference that you want, and then click OK.
But problem is in the select a function list under User Defined
category,
there is no SpellNumber to click. How do I creat new function
(SpellNumber)
name ? Help me.







Montu

How can I creat userdefine function
 
Sorry Sir, I'm unlucky to take your suggetion. Because I'm unable to
understand the 3rd method. I can't find any option to create user define
function. Kindly tell me clearly or describly.

"David Biddulph" wrote:

Read it again, please. Method 1, Method 2, and Method 3 are the 3 suggested
alternatives of ways of *using* the UDF.
Before you do that you need to go through the stage of *creating* the UDF.
That part is headed "How to create the sample function Called SpellNumber".
--
David Biddulph
Rowing web pages at
http://www.biddulph.org.uk/

"Montu" wrote in message
...
Yes, I have been go through the earlier stage of the instruction (Method
1,2,
& 3), I have applied Method 1 & 2 but no result, & 3 I just tried to
Insert
function, because I have not been using Excel 2000 or Excel 2002. So
what's
wrong with me.

"David Biddulph" wrote:

Try following the instructions at http://support.microsoft.com/kb/213360

The part of the instructions that you quoted below are one of the methods
for *using* the UDF. Have you been through the earlier stage of the
instructions, for *creating* the UDF?
--
David Biddulph

"Montu" wrote in message
...
I want convert number into word in excel 2003, for this reason wanted
support
from microsoft help & support site. They suggest me creat user define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click OK.
5. Enter the number or cell reference that you want, and then click OK.
But problem is in the select a function list under User Defined
category,
there is no SpellNumber to click. How do I creat new function
(SpellNumber)
name ? Help me.







David Biddulph[_2_]

How can I creat userdefine function
 
If you do not understand English then you may be better using a newsgroup in
your own language.

On the page to which I referred you
(http://support.microsoft.com/kb/213360), there is a section entitled:
"How to create the sample function Called SpellNumber"

It says:
"How to create the sample function Called SpellNumber
1.Start Microsoft Excel.
2.Press ALT+F11 to start the Visual Basic Editor.
3.On the Insert menu, click Module.
4.Type the following code into the module sheet.
Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
Dim Dollars, Cents, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
' String representation of amount.
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none.
DecimalPlace = InStr(MyNumber, ".")
' Convert cents and set MyNumber to dollar amount.
If DecimalPlace 0 Then
Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
"00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber < ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp < "" Then Dollars = Temp & Place(Count) & Dollars
If Len(MyNumber) 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
Select Case Dollars
Case ""
Dollars = "No Dollars"
Case "One"
Dollars = "One Dollar"
Case Else
Dollars = Dollars & " Dollars"
End Select
Select Case Cents
Case ""
Cents = " and No Cents"
Case "One"
Cents = " and One Cent"
Case Else
Cents = " and " & Cents & " Cents"
End Select
SpellNumber = Dollars & Cents
End Function

' Converts a number from 100-999 into text
Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
' Convert the hundreds place.
If Mid(MyNumber, 1, 1) < "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
' Convert the tens and ones place.
If Mid(MyNumber, 2, 1) < "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function

' Converts a number from 10 to 99 into text.
Function GetTens(TensText)
Dim Result As String
Result = "" ' Null out the temporary function value.
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99...
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) ' Retrieve ones place.
End If
GetTens = Result
End Function

' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function"
You need to do that to create your UDF before you can use it.
--
David Biddulph

"Montu" wrote in message
...
Sorry Sir, I'm unlucky to take your suggetion. Because I'm unable to
understand the 3rd method. I can't find any option to create user define
function. Kindly tell me clearly or describly.

"David Biddulph" wrote:

Read it again, please. Method 1, Method 2, and Method 3 are the 3
suggested
alternatives of ways of *using* the UDF.
Before you do that you need to go through the stage of *creating* the
UDF.
That part is headed "How to create the sample function Called
SpellNumber".
--
David Biddulph
Rowing web pages at
http://www.biddulph.org.uk/

"Montu" wrote in message
...
Yes, I have been go through the earlier stage of the instruction
(Method
1,2,
& 3), I have applied Method 1 & 2 but no result, & 3 I just tried to
Insert
function, because I have not been using Excel 2000 or Excel 2002. So
what's
wrong with me.

"David Biddulph" wrote:

Try following the instructions at
http://support.microsoft.com/kb/213360

The part of the instructions that you quoted below are one of the
methods
for *using* the UDF. Have you been through the earlier stage of the
instructions, for *creating* the UDF?
--
David Biddulph

"Montu" wrote in message
...
I want convert number into word in excel 2003, for this reason wanted
support
from microsoft help & support site. They suggest me creat user
define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click
OK.
5. Enter the number or cell reference that you want, and then click
OK.
But problem is in the select a function list under User Defined
category,
there is no SpellNumber to click. How do I creat new function
(SpellNumber)
name ? Help me.









Montu

How can I creat userdefine function
 
Thank you for suggestion, but problem is that I don't use to macro. Because I
don't know VB. I just want to creat in Excel 2003. If I open VB Edition (Alt
+ f11) & copy total code which you have suggested. It only can be use one PC.
But if can creat in excel 2003 then I can use it any PC. Is there any
solution to create UDF.

"David Biddulph" wrote:

If you do not understand English then you may be better using a newsgroup in
your own language.

On the page to which I referred you
(http://support.microsoft.com/kb/213360), there is a section entitled:
"How to create the sample function Called SpellNumber"

It says:
"How to create the sample function Called SpellNumber
1.Start Microsoft Excel.
2.Press ALT+F11 to start the Visual Basic Editor.
3.On the Insert menu, click Module.
4.Type the following code into the module sheet.
Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
Dim Dollars, Cents, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
' String representation of amount.
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none.
DecimalPlace = InStr(MyNumber, ".")
' Convert cents and set MyNumber to dollar amount.
If DecimalPlace 0 Then
Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
"00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber < ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp < "" Then Dollars = Temp & Place(Count) & Dollars
If Len(MyNumber) 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
Select Case Dollars
Case ""
Dollars = "No Dollars"
Case "One"
Dollars = "One Dollar"
Case Else
Dollars = Dollars & " Dollars"
End Select
Select Case Cents
Case ""
Cents = " and No Cents"
Case "One"
Cents = " and One Cent"
Case Else
Cents = " and " & Cents & " Cents"
End Select
SpellNumber = Dollars & Cents
End Function

' Converts a number from 100-999 into text
Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
' Convert the hundreds place.
If Mid(MyNumber, 1, 1) < "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
' Convert the tens and ones place.
If Mid(MyNumber, 2, 1) < "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function

' Converts a number from 10 to 99 into text.
Function GetTens(TensText)
Dim Result As String
Result = "" ' Null out the temporary function value.
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99...
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) ' Retrieve ones place.
End If
GetTens = Result
End Function

' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function"
You need to do that to create your UDF before you can use it.
--
David Biddulph

"Montu" wrote in message
...
Sorry Sir, I'm unlucky to take your suggetion. Because I'm unable to
understand the 3rd method. I can't find any option to create user define
function. Kindly tell me clearly or describly.

"David Biddulph" wrote:

Read it again, please. Method 1, Method 2, and Method 3 are the 3
suggested
alternatives of ways of *using* the UDF.
Before you do that you need to go through the stage of *creating* the
UDF.
That part is headed "How to create the sample function Called
SpellNumber".
--
David Biddulph
Rowing web pages at
http://www.biddulph.org.uk/

"Montu" wrote in message
...
Yes, I have been go through the earlier stage of the instruction
(Method
1,2,
& 3), I have applied Method 1 & 2 but no result, & 3 I just tried to
Insert
function, because I have not been using Excel 2000 or Excel 2002. So
what's
wrong with me.

"David Biddulph" wrote:

Try following the instructions at
http://support.microsoft.com/kb/213360

The part of the instructions that you quoted below are one of the
methods
for *using* the UDF. Have you been through the earlier stage of the
instructions, for *creating* the UDF?
--
David Biddulph

"Montu" wrote in message
...
I want convert number into word in excel 2003, for this reason wanted
support
from microsoft help & support site. They suggest me creat user
define
function like this way
1. Select the cell that you want.
2. Click Insert Function on the Standard toolbar.
3. Under Or select a category, click User Defined.
4. In the Select a function list, click SpellNumber, and then click
OK.
5. Enter the number or cell reference that you want, and then click
OK.
But problem is in the select a function list under User Defined
category,
there is no SpellNumber to click. How do I creat new function
(SpellNumber)
name ? Help me.











All times are GMT +1. The time now is 05:28 AM.

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