简体   繁体   English

根据日期计算总和

[英]Calculate SUM based on date

This is driving me nuts and I don't know what I'm doing wrong. 这让我发疯,我不知道我在做什么错。

I have an excel table where my turnover is in with the date of incoming invoices. 我有一个excel表,其中我的营业额与收到的发票的日期有关。 The date is in format ddmmjjj and is in column C. 日期格式为ddmmjjj ,在C列中。

I want to calculate my turnover on my dashboard. 我想在仪表板上计算营业额。 The total turnover is in column G. 总成交额在G列中。

The formula I use is: 我使用的公式是:

=SUM(IF(MONTH(Sheet1!C:C)=2;Sheet!G:G;))

But this formula keeps giving me the total turnover... What am I doing wrong? 但是这个公式一直在给我总营业额...我在做什么错?

您使用的公式是正确的,但是您需要将其作为数组公式输入(通过Ctrl + Shift + Enter )。

=SUM(IF(MONTH(Sheet1!C:C)=2,Sheet1!G:G,0))

You need to use the SUMIF function in Excel, which allows you to sum up certain cells if the values in associated cells match a criteria: 您需要在Excel中使用SUMIF函数 ,如果关联的单元格中的值与条件匹配,则该函数可用于汇总某些单元格:

SUMIF(range, criteria, [sum_range])

In your case, you'd want to extract the month for the dates in column C into another column (say column X holds the month for the dates in column C), and then: 在您的情况下,您希望将C列中的日期的月份提取到另一列中(例如X列保留C列中的日期的月份),然后:

=SUMIF(Sheet1!X:X, 2, Sheet1!G:G) 

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

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