简体   繁体   English

Excel:将公式应用于另一个公式中列中的每个单元格

[英]Excel: Apply formula to each cell in column within another formula

I have a column of numbers. 我有一列数字。 I want to ROUND the numbers in each cell of the column and then take the SUM of the cells. 我想将列的每个单元格中的数字都ROUND整,然后取这些单元格的SUM

Of course this can be done by creating another column with the rounded values and then taking its sum. 当然,这可以通过使用舍入后的值创建另一列然后取其总和来完成。

Say that I have 10 cells in column A. I round them to the nearest 0 using ROUND(A#,0) for A1 through A10. 假设我在A列中有10个单元格。我使用ROUND(A#,0)将A1到A10舍入到最接近的0。 These new values go in B# . 这些新值在B# Then in B11 I have SUM(B1:B10) . 然后在B11SUM(B1:B10)

Is there a way to apply the ROUND forumla to each cell in column A within the SUM function so that I do not need to create another column of values? 有没有一种方法可以将ROUND forumla应用于SUM函数中A列的每个单元格,这样我就不必创建另一列值了?

SUMPRODUCT阵列中的“交易” 2

=SUMPRODUCT(ROUND(A1:A10,0))

Just use an array formula - enter with Ctrl + Shift + Enter . 只需使用数组公式-用Ctrl + Shift + Enter即可输入

=SUM(ROUND(A1:A10,0))

For example (also shows the rounded numbers in Column B to show it works, or you can see the magic with Formulas > Evaluate Formula .) 例如((在B列中还显示了四舍五入的数字以表明其有效,或者您可以使用“ 公式” >“ 评估公式”来查看魔术)。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM