By: Shamima Sultana

In reply to Katrina.

Hello Katrina,

Thank you so much for your feedback and for bringing up this great point!

To remove the “0/100” when there are no centavos, you can modify the code slightly. Here’s how you can do it:

Replace the last part of the NumberToWords function with this logic:

If DecimalPart > 0 Then
NumberToWords = Words & " and " & DecimalPart & "/100"
Else
NumberToWords = Words & " Only"
End If

So the relevant part of the code should look like this:

' Combine whole part and decimal part into final result
If DecimalPart > 0 Then
NumberToWords = Words & " and " & DecimalPart & "/100"
Else
NumberToWords = Words & " Only"
End If

Now, for an amount like 30,015.00, the result will be:
“Thirty Thousand Fifteen Only”

And if the amount has cents (like 30,015.75), it will still show:
“Thirty Thousand Fifteen and 75/100”

Let me know if you have any more questions or need further help!

Regards,
ExcelDemy