简体   繁体   English

Excel:SUMIF与LOOKUP结合用于日期范围之间的日期

[英]Excel: SUMIF combined with LOOKUP for date between date range

I have two sheets - 1) Reduction 2) Calendar. 我有两张纸-1)缩小2)日历。

A sampling of the data in Sheet #1 - Reduction: 工作表#1中的数据采样-减少:

     A          B           C           D 
1    Start      End         Resource    Reduction
2    1/4/2016   1/6/2016    Andrew      -8
3    3/11/2016  4/1/2016    Andrew      -2
4    1/5/2016   1/6/2016    Emily       -0.5
5    1/4/2016   1/7/2016    Andrew      -0.5

Format of Sheet #2 - Calendar: 工作表#2-日历的格式:

     A          B           C           D           E           F
1    Resource   1/4/2016    1/5/2016    1/6/2016    1/7/2016    1/8/2016
2    Andrew                 
3    Maria                  
4    Emily                  

What I'm trying to accomplish is identify any reductions for the resource identified in Calendar A1:A4 and sum those reductions to identify a daily total reduction. 我要完成的工作是确定日历A1:A4中标识的资源的任何减少量,并将这些减少量相加,以确定每日的总减少量。 I need to lookup the reductions and sum them from the Reduction sheet. 我需要查找减少量,并从减少量表中求和。

So for Cell Calendar C2 (Andrew for 1/5/16) I am looking at the Reductions sheet to find any of Andrew's reductions for the date of 1/5. 因此,对于Cell Calendar C2(对于1/5/16是安德鲁),我正在查看减少量表,以查找1/5日期中安德鲁的任何减少量。 Which should return then a reduction of -8.5 (rows 2 & 5 from the Reductions sheet = -8 + -.5). 然后应该返回减少值-8.5(“减少量”表上的第2行和第5行= -8 + -.5)。

I'm wondering if I can combine SUMIFS and LOOKUP to accomplish this or if there is a better way of going about it. 我想知道我是否可以结合SUMIFS和LOOKUP来完成此任务,或者是否有更好的解决方案。

Thank you in advance! 先感谢您!

Use SUMIFS(): 使用SUMIFS():

=SUMIFS(Sheet1!$D:$D,Sheet1!$A:$A,"<="&B$1,Sheet1!$B:$B,">="&B$1,Sheet1!$C:$C,$A2)

在此处输入图片说明

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

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