Two UDF Functions with the same name

andreascostas

Board Regular
Joined
Jan 11, 2011
Messages
150
OK. I have two UDF functions both named the same thing: :Decompose", each one decomposes a number
but in different format. Now i need to use both functions in the same worksheet, but excel won't let me do that.
How do I go about doing that.
Here are the functions:

Function Decompose(ByVal Number As String) As String
Dim X As Long
Number = Replace(Number, ",", "")
If Number = 0 Then
Decompose = "0 ones"
Else
For X = Len(Number) To 1 Step -1
If Mid(Number, X, 1) Then Decompose = Mid(Number, X, 1) & Choose(Len(Number) - X + 1, " ones", " tens", " hundreds", " thousands", " ten thousands", " hundreds thousands") & " + " & Decompose
Next
Decompose = Left(Decompose, Len(Decompose) - 3)
End If
End Function

second function

Function Decompose(ByVal Number As String) As String
Dim X As Long
Number = Replace(Number, ",", "")
If Number = 0 Then
Decompose = "0 ones"
Else
For X = Len(Number) To 1 Step -1
If Mid(Number, X, 1) Then Decompose = Mid(Number, X, 1) & Choose(Len(Number) - X + 1, " x 1)", " x 10)", " x 100)", " x 1,000)", " x 10,000)", " x 100,000)") & " + " & Decompose
Next
Decompose = Left(Decompose, Len(Decompose) - 3)
End If
End Function
 
Yes I did that comment. I didn't write the code or review it - I just tried to put the two UDF's into a single UDF so the user could use it that way.
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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