?
Solved

Excel 2007 Incomplete Date Sum Array lookup

Posted on 2012-03-19
6
Medium Priority
?
382 Views
Last Modified: 2012-08-13
MS Excel 2007  SVC Pack1 XP Service Pack3
Tab Input Cell B4 = 03/18/2012
Tab Visit Type1 row 2 starting dates row 3 - 9 Monday - Sunday Row 10 Weekly Totals
Yearly averages can be approximate and are computed with an array

{=SUM((IF(YEAR(Input!$B$4)=YEAR($B$2:$HI$2),$B3:$HI9,FALSE)))}

However Current monthly totals must be exact

Reduced screenshot

      Week of      Week of      Week of
      27-Feb      5-Mar      12-Mar
Monday       60        44        62
Tuesday       58        52        53
Wednesday       53        59        56
Thursday       44        45        46
Friday       63        45        64
Saturday       48        45        51
Sunday       39        42        57
Wkly Total       365        332        389

02/27 = 60, 02/28=58, 02/29=53, 03/01 = 44, 03/02=63, 03/03=48, 03/04=39 03/18=57
I need to add March and only March starting with 03/01 of 44 and ending with 03/18 57 for a total of 915
visit2.xls
0
Comment
Question by:avgplusguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 42

Expert Comment

by:dlmille
ID: 37739601
March weekly total looks like 721 - that's 332 + 389, right?

Use this revised formula:

=SUMPRODUCT(($B$3:$HI$9)*(YEAR($B$2:$HI$2)=YEAR(Input!B4))*(MONTH($B$2:$HI$2)=MONTH(Input!B4)))

Also, your original array formula could be written as:

=SUM((IF((MONTH(Input!$B$4)=MONTH($B$2:$HI$2))*(YEAR(Input!$B$4)=YEAR($B$2:$HI$2)),$B3:$HI9,FALSE)))

CTRL+SHIFT+ENTER to confirm

Dave
0
 

Author Comment

by:avgplusguy
ID: 37739664
Dave,
That will probably give me the approximation based on the starting week.
March total is 332 + 389 + 44 +63 + 48 + 39. Two weeks are totally in March and there are four March Days in the week that started in February. The bad part is the date only applies to row 3. I am thinking this might work better in Access than Excel. Normally you have to worry about the first and last week of the month.
0
 
LVL 42

Assisted Solution

by:dlmille
dlmille earned 400 total points
ID: 37739815
That's a bit more tricky, but here's your corrected formula:

=SUMPRODUCT(($B$3:$M$9)*(YEAR($B$2:$M$2)=YEAR(Input!B4))*(MONTH($B$2:$M$2+ROW($A$3:$A$9)-ROW($A$3))=MONTH(Input!B4)))


Dave
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 50

Accepted Solution

by:
barry houdini earned 1600 total points
ID: 37740082
This version will also work

=SUMPRODUCT((TEXT(B2:M2+{0;1;2;3;4;5;6},"mmmyy")=TEXT(Input!B4,"mmmyy"))+0,B3:M9)

regards, barry
0
 

Author Closing Comment

by:avgplusguy
ID: 37740303
Great work guys. Both solutions worked for March and February. Barry's solution works for January which has one day listed under Dec 26th that Dave does not capture.

Dave got the ball rolling and I almost understood his solution. how does -row($A$3) almost make this work at the end?  

Barry I copied and pasted your solution. The braces are typed as braces or do they have to be entered in with the Cntrl+Shift+Enter?
0
 
LVL 42

Expert Comment

by:dlmille
ID: 37740320
Mine didn't work because we were using Year comparison in the equation and needed to treat the weekdays the same as the month.

The corrected formula is:

=SUMPRODUCT(($B$3:$M$9)*(YEAR($B$2:$M$2+ROW($A$3:$A$9)-ROW($A$3))=YEAR(Input!B4))*(MONTH($B$2:$M$2+ROW($A$3:$A$9)-ROW($A$3))=MONTH(Input!B4)))

It sounds like you have an understanding of barry's solution, so I guess you're good.

Mine checks the year of the date and the month of the date and compares to the input.  the +Row($A$3:$A$9)-row($A$3) is similar math to add the 0-6 days from the top date as barry's equation does.

Cheers,

Dave
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question