Number to Text??

Utradeshow

Well-known Member
Joined
Apr 26, 2004
Messages
800
Office Version
  1. 365
Hi Guys, Is there a way to do this??

Enter Say 352 in cell A1 and have cell A2 Turn the 352 into THREE FIVE TWO Or to spell it out in some way like you would write a check???
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Sub Num2Text()
'select the cell with the formula in

Dim c As Range
For Each c In Selection

AmountWord = ""
FracString = ""
OrigNum = c.Value

If InStr(1, OrigNum, ".") > 0 Then
Num = Left(OrigNum, InStr(1, OrigNum, ".") - 1)
FracString = Fraction(Right(OrigNum, Len(OrigNum) - InStr(1, OrigNum, ".")))
Else
Num = OrigNum
FacString = ""

End If

Do

If ((Len(Num) + 1) Mod 3) = 0 Then
HeadNum = Mid(Num, 1, 2)
TailLen = Len(Num) - 2
AmountWord = AmountWord & " " & HeadWord(HeadNum)

If HeadNum > 10 And HeadNum < 20 Then
Num = Right(Num, Len(Num) - 2)
AmountWord = AmountWord & " " & TailWord(TailLen)

Else
Num = Mid(Num, 2, Len(Num) - 1)
End If
Else
HeadNum = Mid(Num, 1, 1)
TailLen = Len(Num) - 1
AmountWord = AmountWord & " " & HeadWord(HeadNum) & " " & TailWord(TailLen)
'Num = Mid(Num, 2, Len(Num) - 1)
If Len(Num) > 1 Then
Num = Mid(Num, 2, Len(Num) - 1)
Else
Exit Do
End If

End If
Loop Until Len(Num) = 0

c.Value = AmountWord & " " & FracString
Next c
End Sub

Function Fraction(RemainNum) As String
Fraction = Round(RemainNum, 2) & "/100"
End Function

Function TailWord(TailLen) As String
Select Case TailLen
Case 7: TailWord = "Hundred"
Case 6: TailWord = "Million"
Case 5: TailWord = "Hundred"
Case 4: TailWord = "Thousand"
Case 3: TailWord = "Thousand"
Case 2: TailWord = "Hundred"
End Select
End Function

Function HeadWord(Num) As String
Select Case Num
Case 90 To 99: HeadWord = "Ninety"
Case 80 To 89: HeadWord = "Eighty"
Case 70 To 79: HeadWord = "Seventy"
Case 60 To 69: HeadWord = "Sixty"
Case 50 To 59: HeadWord = "Fifty"
Case 40 To 49: HeadWord = "Fourty"
Case 30 To 39: HeadWord = "Thirty"
Case 20 To 29: HeadWord = "Twenty"
Case 19: HeadWord = "Nineteen"
Case 18: HeadWord = "Eightteen"
Case 17: HeadWord = "Seventeen"
Case 16: HeadWord = "Sixteen"
Case 15: HeadWord = "Fifteen"
Case 14: HeadWord = "Fourteen"
Case 13: HeadWord = "Thirteen"
Case 12: HeadWord = "Twelve"
Case 11: HeadWord = "Eleven"
Case 10: HeadWord = "Ten"
Case 9: HeadWord = "Nine"
Case 8: HeadWord = "Eight"
Case 7: HeadWord = "Seven"
Case 6: HeadWord = "Six"
Case 5: HeadWord = "Five"
Case 4: HeadWord = "Four"
Case 3: HeadWord = "Three"
Case 2: HeadWord = "Two"
Case 1: HeadWord = "One"
End Select
End Function
 
Upvote 0
It works, But These make it all say Dollars and Cents.. I just need it to be numbers, not currency?
 
Upvote 0

Forum statistics

Threads
1,222,738
Messages
6,167,905
Members
452,155
Latest member
Prakash K

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