总和值与多个标准比较日期范围 [英] Sum values with multiple criteria comparing date ranges

查看:116
本文介绍了总和值与多个标准比较日期范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的资料:

  ABC 
1/1/2010 1200.00 1/1/2010
1/10/2010 300.00 1/10/2010
2/1/2010 -500.00 2/2/2010
2/5/2010 900.00 2/6/2010
3/1 / 2010 670.00 3/1/2010

我需要公式:


  1. B IF A和C的值的总和相等,属于2010年1月的
    月份

  2. B IF A和C的值的总和不相等,属于2010年2月份。

鉴于两个日期(A和C)同一个月下降;他们只是几天分开。我已经使用sumproduct已经是A和C是相等的条件,但我困惑在哪里放置日期范围的标准。

解决方案

总和列B,其中列A等于列C,两列都在2010年1月的月份和年份。

  = SUMPRODUCT((TEXT(A1:A5,mmyyyy)=012010)*(A1:A5 = C1:C5),B1:B5)
pre>

总和列B,列A不等于列C,两列都在2010年2月的月份和年份,

  = SUMPRODUCT((TEXT(A1:A5,mmyyyy)=022010)*(TEXT(C1:C5,mmyyyy)=022010 )*(A1:A5 C1:C5),B1:B5)


My Data:

A          B        C
1/1/2010   1200.00  1/1/2010
1/10/2010  300.00   1/10/2010
2/1/2010   -500.00  2/2/2010
2/5/2010   900.00   2/6/2010
3/1/2010   670.00   3/1/2010

I need formulae for:

  1. The sum of the values of B IF A and C are equal AND belong in the month of January 2010
  2. The sum of the values of B IF A and C are NOT equal AND belong in the month of February 2010

Given that both dates (A and C) fall on the same month; they're just days apart. I've used sumproduct already for the condition that A and C are equal, but I'm confused where to put the criteria for the date range.

解决方案

Sum column B where column A equals column C and both columns are in the month and year of January, 2010,

=SUMPRODUCT((TEXT(A1:A5, "mmyyyy")="012010")*(A1:A5=C1:C5), B1:B5)

Sum column B where column A does not equal column C and both columns are in the month and year of February, 2010,

=SUMPRODUCT((TEXT(A1:A5, "mmyyyy")="022010")*(TEXT(C1:C5, "mmyyyy")="022010")*(A1:A5<>C1:C5), B1:B5)

这篇关于总和值与多个标准比较日期范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆