Signature (Visual Basic / VBA)
Public Function ArabicToRoman( _
ByVal vValue As Variant _
) As Variant
Code Example
ArabicToRoman(1) = "I"
ArabicToRoman(2000) = "MM"
ArabicToRoman(1999) = "MCMXCIX"
ArabicToRoman(1996) = "MCMXCVI"
ArabicToRoman(#4/20/1996#) = "MCMXCVI" ' #5
ArabicToRoman(1234567) = "mccxxxMvDLXVII"
ArabicToRoman(-34) = ""
ArabicToRoman(123) = "CXXIII"
ArabicToRoman(123.45) = "CXXIII"
ArabicToRoman(678) = "DCLXXVIII"
ArabicToRoman(#1/5/678#) = "DCLXXVIII" ' #11
Parameters
| Parameter | Description |
|---|---|
| vValue | The number or date whose Roman equivalent will be returned. Function returns Null if vValue is Null or cannot be fixed up to a number or date. |
Notes & Version History
| Note | In the Roman numeral system, a line across the top of the letter means multiply by 1,000. Since there is no standard computer character for these Roman numerals, this function returns the lower-case version of the character. Upper-case letters have the standard translations (i.e. I = 1, V = 5, X = 10, etc.) and lower-case letters represent the corresponding value times 1,000 (i.e. v = 5,000, x = 10,000, etc.). Any Roman number greater than or equal to 4,000 will contain at least one of these lower-case letters. |
| Note | If vValue is a Date, this function will return the Roman number for the Year component of the Date (as in examples #5 and #11), instead of converting the date to a number (which is the usual way to fix-up Dates to Numbers). Function returns an empty string ("") if vValue is less than 1 (one) or greater than 3,999,999. |