简体   繁体   English

在Excel中,对每行中一列中的所有值求和,其中另一列是特定值

[英]In Excel, sum all values in one column in each row where another column is a specific value

I'm wondering if there is an easy way to do what I'm looking for. 我想知道是否有一种简单的方法来做我正在寻找的东西。 Basically, I have a balance sheet in Excel 2011 with a bunch of data. 基本上,我在Excel 2011中有一堆资产表和一堆数据。 One specific piece of information I always want visible is the amount that hasn't been reimbursed. 我一直希望看到的一条特定信息是尚未报销的金额。 In other words, I have a column for the amount paid and another for whether or not it has been reimbursed (Yes/No). 换句话说,我有一个支付金额的列,另一个是否已经报销(是/否)。 I want to sum all of the amounts paid where the reimbursed field is equal to 'No'. 我希望将报销字段等于“否”的所有已支付金额相加。

I recognize I can sum the entire column and filter out those that have been reimbursed, but I'd like it to display the full amount regardless of what filter is on (or if no filter is on). 我知道我可以对整个列进行求和并筛选出已经报销的那些,但我希望它能显示全部数量,无论过滤器是什么(或者没有打开过滤器)。

I wasn't able to find good keywords to describe this to Google, so I'm asking here. 我无法找到好的关键字来向Google描述这一点,所以我在这里问。 I would like to accomplish this in Excel, not in an external program or script. 我想在Excel中完成此操作,而不是在外部程序或脚本中。

If column A contains the amounts to be reimbursed, and column B contains the "yes/no" indicating whether the reimbursement has been made, then either of the following will work, though the first option is recommended: 如果列A包含要报销的金额,并且列B包含“是/否”,表示是否已进行报销,则以下任一方法都可以,但建议使用第一个选项:

=SUMIF(B:B,"No",A:A)

or 要么

=SUMIFS(A:A,B:B,"No")

Here is an example that will display the amounts paid and outstanding for a small set of sample data. 这是一个示例,它将显示一小组样本数据的已支付金额和未付金额。

 A         B            C                   D
 Amount    Reimbursed?  Total Paid:         =SUMIF(B:B,"Yes",A:A)
 $100      Yes          Total Outstanding:  =SUMIF(B:B,"No",A:A)
 $200      No           
 $300      No
 $400      Yes
 $500      No

Excel计算的结果

You could do this using SUMIF . 您可以使用SUMIF执行此操作。 This allows you to SUM a value in a cell IF a value in another cell meets the specified criteria. 这允许您对单元格中的值进行求和,以使另一个单元格中的值满足指定的条件。 Here's an example: 这是一个例子:

 -   A         B
 1   100       YES
 2   100       YES
 3   100       NO

Using the formula: =SUMIF(B1:B3, "YES", A1:A3) , you will get the result of 200 . 使用公式: =SUMIF(B1:B3, "YES", A1:A3) ,您将得到200的结果。

Here's a screenshot of a working example I just did in Excel: 这是我在Excel中执行的一个工作示例的屏幕截图:

Excel SUMIF示例

You should be able to use the IF function for that. 你应该可以使用IF函数。 the syntax is =IF(condition, value_if_true, value_if_false) . 语法是=IF(condition, value_if_true, value_if_false) To add an extra column with only the non-reimbursed amounts, you would use something like: 要添加仅包含非报销金额的额外列,您可以使用以下内容:

=IF(B1="No", A1, 0)

and sum that. 并总结一下。 There's probably a way to include it in a single cell below the column as well, but off the top of my head I can't think of anything simple. 可能有一种方法可以将它包含在列下方的单个单元格中,但是在我的脑海中,我无法想到任何简单的事情。

暂无
暂无

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

相关问题 Excel,计算一列的总和,其中另一列中的相应行等于一个值 - Excel, Calculate Sum of one column where the corresponding row in another column equals a value 根据另一列中的值求和一列中的值-Excel 2013 - Sum the value in one column based on the value in another column - excel 2013 EXCEL-相邻列中每个值的列中值的总和 - EXCEL - sum of values in column for each value in adjacent column 将一列中的所有数值相加,而另一列中的日期年份等于2014? - Sum all number values in one column where year of date in another column equals 2014? 擅长将一列包含多个单词重复项,将另一列包含值(数字),并需要用公式将每个单词的所有值求和 - excel one column with many word duplicates and the other with values (number) and need to sum all values for each word with formula VBA代码基于Excel中另一列中的值对一列中的值求和 - VBA Code to sum values in one column based on the value in another column in excel Excel-在另一列中找到匹配项的行中获取列的值 - Excel - Get value of a column in a row where match found in another column 在Excel中如何计算一个列中每个值的出现并将其按另一列中的值分组 - In excel how to count the occurrence of each value in one column and group it by values in another column 如何为另一列中的每一行重复所有列值 - How to repeat all column values for each row in another column 列中与excel中另一列中的特定值相对应的值列表 - the listing of values in a column that correspond to a specific value in another column in excel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM