Excel digital-to-capital figures (including decimal point)

Excel summarizes the current digital revolution uppercase two ways.

The first: using the formula

=TEXT(TRUNC(F18),"[DBNum2]")&"元"&TEXT(RIGHT(FIXED(F18),2),"[dbnum2]0角0分整;;"&IF(ABS(F18)>1%,"整",))

The second: Scripting

VBA custom macro function to achieve the first step by: - ​​Macros --Visual Basic Editor, Visual Basic programming environment to enter, click on the "Insert" menu - press ALT + F11 key combination, or click Tools module, copy the following code, save and exit is closed.

Function N2RMB(M)
y = Int(Round(100 * Abs(M)) / 100)
j = Round(100 * Abs(M) + 0.00001) - y * 100
f = (j / 10 - Int(j / 10)) * 10
A = IIf(y < 1, "", Application.Text(y, "[DBNum2]") & "元")
b = IIf(j > 9.5, Application.Text(Int(j / 10), "[DBNum2]") & "角", IIf(y < 1, "", IIf(f > 1, "零", "")))
c = IIf(f < 1, "整", Application.Text(Round(f, 0), "[DBNum2]") & "分")
N2RMB = IIf(Abs(M) < 0.005, "", IIf(M < 0, "负" & A & b & c, A & b & c))
End Function

Back excel interface, enter the cell B1: = N2RMB (A1), can be converted to a digital cell A1 RMB capital, and then copy the formula down to all of the digital converted RMB capital.

Published 47 original articles · won praise 3 · Views 5373

Guess you like

Origin blog.csdn.net/weixin_43221207/article/details/104673386