简体   繁体   中英

Excel: SUMIF combined with LOOKUP for date between date range

I have two sheets - 1) Reduction 2) Calendar.

A sampling of the data in Sheet #1 - Reduction:

     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:

     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. 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. Which should return then a reduction of -8.5 (rows 2 & 5 from the Reductions sheet = -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.

Thank you in advance!

Use SUMIFS():

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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