如何将整数自动转换为2个小数点? [英] How to auto-convert a whole number into it's 2 decimals points?
本文介绍了如何将整数自动转换为2个小数点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按照先前的答案 给出的公式未返回整数(任何不带小数的数字,例如1(.00),12(.00)等)的结果.
The formula given didn't return a result for whole numbers (any number without decimals, for example: 1(.00), 12(.00) etc.).
要使其也返回带有整数的输入的结果, 我想到了这样的公式:
To make it return a result also for inputs with whole numbers, I thought of some formula like this:
=IF(A1=(a whole number/number without decimals),A1.00(A1 formatted as a whole number with two decimals),A1(A1 with any number of decimals>2 decimals).
如何制作此公式
=ARRAYFORMULA(
IF((LEN(IFERROR(REGEXEXTRACT(TO_TEXT(A1:A), "\.(.*)")))=4) *
(A1:A>B1:B) * (C1:C="Good"), (A1:A-B1:B)*10000,
IF((LEN(IFERROR(REGEXEXTRACT(TO_TEXT(A1:A), "\.(.*)")))=2) *
(A1:A>B1:B) * (C1:C="Great"), (A1:A-B1:B)*100, )))
对整数也有效吗?
这样它也返回整数的结果吗?
So that it returns a result for the whole number as well?
推荐答案
=ARRAYFORMULA(
IF((LEN(IFERROR(REGEXEXTRACT(TO_TEXT(A1:A), "\.(.*)")))=4) *
(A1:A>B1:B) * (C1:C="Good"), (A1:A-B1:B)*10000,
IF((LEN(IFERROR(REGEXEXTRACT(TO_TEXT(TEXT(A1:A, "00.00")), "\.(.*)")))=2) *
(A1:A>B1:B) * (C1:C="Great"), (A1:A-B1:B)*100, )))
这篇关于如何将整数自动转换为2个小数点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文