Je veux convertir la valeur numérique en Dinars koweïtiens en Mots dans Excel, Par exemple:
120.050 KWD = Cent Vingt Dinars Koweïtiens et Cinquante Fils Seulement.
100 KWD = Cent dinars koweïtiens seulement.Convertir Nombre de mots pour le Koweït Dinar
0
A
Répondre
0
Cela peut être fait en utilisant l'arithmétique modulo:
Function NumberToFullProseForm(value As Decimal) As String
Dim value As Decimal = 120.050
Dim v100 As Decimal = (value % 100)/100
Dim v10 As Decimal = (value % 10)/10
Dim v1 As Decimal = value % 1
Dim v01 As Decimal = (value * 10) % 1
Dim v001 As Decimal = (value * 100) % 1
Dim output =
DigitToText(v100) + " Hundred and " +
DigitToTens(v10) + " and " +
DigitToText(v1) + " Dinars and" +
DigitToText(v01) + " Tens" +
DigitToText(vv001) + " Cents"
Return output
End Function
Function DigitToText(digit As Char) As String
If digit = 0 Then Return "Zero"
If digit = 1 Then Return "One"
' etc
End Function
Function DigitToTens(digit As Char) As String
If digit = 0 Then Return ""
If digit = 1 Then Return "Ten"
If digit = 2 Then Return "Twenty"
' etc
End Function
Tweak as-est nécessaire.
+0
Cette fonction existe-t-elle pour une région spécifique? Je n'ai aucun type de données 'Decimal' dans mon Excel 2007. – harun24hr
Est-ce que la réponse suivante a résolu votre problème? Peut être je peux vous aider peu. – harun24hr