Home >Topics >excel >Four steps to teach you how to convert RMB numerical amounts into Chinese capital letters in Excel

Four steps to teach you how to convert RMB numerical amounts into Chinese capital letters in Excel

WBOY
WBOYforward
2022-06-24 11:56:367511browse

This article brings you relevant knowledge about excel, which mainly summarizes the methods of converting RMB numerical amounts into Chinese capital letters. Let’s take a look at them together. I hope it will be helpful to everyone.

Four steps to teach you how to convert RMB numerical amounts into Chinese capital letters in Excel

Related learning recommendations: excel tutorial

To convert numerical amounts into Chinese uppercase letters, you need to go through the following steps:

1. Convert Arabic lowercase numbers to Chinese uppercase. This can be used in the examples in the previous chapters to convert numbers into Chinese uppercase codes, such as:

Function RmbDx(ByVal c) As String<br>Application.Volatile True<br>c = Val (c)<br>RmbDx = Application.WorksheetFunction.Text(c, "[DBNum2]")<br>RmbDx = Replace(RmbDx, "-", "negative")<br>End Function

2. Add "yuan" after the integer amount. You can use the IF statement and FIX rounding function to determine whether an amount is an integer amount.

Function RmbDx(ByVal c) As String<br>Application.Volatile True<br>c = Val(c)<br>RmbDx = Application.WorksheetFunction.Text(c, "[DBNum2] ")<br>RmbDx = Replace(RmbDx, "-", "negative")<br>If c = Fix(c) Then<br>RmbDx = RmbDx & "元正"<br>End If<br>End Function

3. Add "yuan" and "cent" information to the amount that only contains "corner" information and does not include "cent" information.

Function RmbDx (ByVal c) As String<br>Application.Volatile True<br>Dim p As Integer<br>c = Val(c)<br>RmbDx = Application.WorksheetFunction.Text(c, "[DBNum2]")<br>RmbDx = Replace(RmbDx, "-", "negative")<br>If c = Fix(c) Then<br>RmbDx = RmbDx & "元正"<br>Else<br>RmbDx = Replace(RmbDx, ".", "元")<br>If c * 10 = Fix(c * 10) Then<br>RmbDx = RmbDx & "角"<br>End If<br>End If<br>End Function

4. Add "angle" and "minute" information to the data containing "angle" and "minute" information.

Function RmbDx(ByVal c) As String<br>Application.Volatile True<br>Dim p As Integer<br>c = Val(c)<br>RmbDx = Application.WorksheetFunction.Text (c, "[DBNum2]")<br>RmbDx = Replace(RmbDx, "-", "negative")<br>If c = Fix(c) Then<br>RmbDx = RmbDx & "元全"<br>Else<br>p = InStr(RmbDx, ".")<br>RmbDx = Replace(RmbDx, ".", "元")<br>If c * 10 = Fix(c * 10) Then<br> RmbDx = RmbDx & "corner"<br>Else<br>RmbDx = Left(RmbDx, p) & Mid(RmbDx, p 1, 1) & "corner" & Right(RmbDx, 1) & "分"<br> End If<br>End If<br>End Function

In this way, you can get the custom function RmbDx that converts the RMB amount into Chinese uppercase amount. The effect is as shown below.

Four steps to teach you how to convert RMB numerical amounts into Chinese capital letters in Excel

Related learning recommendations: excel tutorial

The above is the detailed content of Four steps to teach you how to convert RMB numerical amounts into Chinese capital letters in Excel. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete