Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 30
Default SumIf statement: incrementing

I have the following formula:
=SUMIF('weekly dates'!A1:AZ1,""&A5,Details!L7:BK7)

Weekly dates is a static sheet, &A5 is the current date and Details!L7:BK7
are cells that are calculated weekly on a sheet different from where this
formula is used.

There are 4 weeks per period and this report is done weekly. I need the
SUMIF to be just as it is for week 1, but for week 2, I need to include weeks
1&2, week 3 to include 1-3 and week 4 to include 1-4. Then it starts over
after week 4. I can do by changing the formula weekly in the following way.
=SUMIF('weekly dates'!A1:AZ1,""&A5-8,Details!L7:BK7) week2
=SUMIF('weekly dates'!A1:AZ1,""&A5-16,Details!L7:BK7) week3
=SUMIF('weekly dates'!A1:AZ1,""&A5-24,Details!L7:BK7) week4

I know there has to be a cleaner and more correct way of doing this. Any
ideas?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,104
Default SumIf statement: incrementing

I put dates in column G and numbers to sum in column H
In A5 I have the "current date"
I used this formula
=SUMIF(G1:G31,""&A5-IF(DAY(A5)<8,8,IF(DAY(A5)<14,16,24)),H1:H31)
to try to duplicate your three options.

DAY(A5) returns the calendar day and I check if was less than 14, less than
14 to compute how many days to subtract from A5.
You will need to work on it - 8 days in a week had me confused
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Kesbutler" wrote in message
...
I have the following formula:
=SUMIF('weekly dates'!A1:AZ1,""&A5,Details!L7:BK7)

Weekly dates is a static sheet, &A5 is the current date and Details!L7:BK7
are cells that are calculated weekly on a sheet different from where this
formula is used.

There are 4 weeks per period and this report is done weekly. I need the
SUMIF to be just as it is for week 1, but for week 2, I need to include
weeks
1&2, week 3 to include 1-3 and week 4 to include 1-4. Then it starts over
after week 4. I can do by changing the formula weekly in the following
way.
=SUMIF('weekly dates'!A1:AZ1,""&A5-8,Details!L7:BK7) week2
=SUMIF('weekly dates'!A1:AZ1,""&A5-16,Details!L7:BK7) week3
=SUMIF('weekly dates'!A1:AZ1,""&A5-24,Details!L7:BK7) week4

I know there has to be a cleaner and more correct way of doing this. Any
ideas?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 30
Default SumIf statement: incrementing

Thanks but this isn't exactly what I need. I need the formula to only
calculate the weeks in that current period. Your formula grabs the weeks
previous based on the date.

Each period has 4 weeks and I need to track each week within each period and
increment as the period progresses.

Week 1 = only calculates week 1
Week 2 = calculates week 1 & week2
Week 3 = calculates weeks 1,2 and 3
Week 4 = calcualtes weeks 1,2,3 and 4.

Then after week 4 it would start over again with week 1 as it would be a new
period.

I guess I'll keep plugging away until I get it figured out.

Thanks

"Bernard Liengme" wrote:

I put dates in column G and numbers to sum in column H
In A5 I have the "current date"
I used this formula
=SUMIF(G1:G31,""&A5-IF(DAY(A5)<8,8,IF(DAY(A5)<14,16,24)),H1:H31)
to try to duplicate your three options.

DAY(A5) returns the calendar day and I check if was less than 14, less than
14 to compute how many days to subtract from A5.
You will need to work on it - 8 days in a week had me confused
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Kesbutler" wrote in message
...
I have the following formula:
=SUMIF('weekly dates'!A1:AZ1,""&A5,Details!L7:BK7)

Weekly dates is a static sheet, &A5 is the current date and Details!L7:BK7
are cells that are calculated weekly on a sheet different from where this
formula is used.

There are 4 weeks per period and this report is done weekly. I need the
SUMIF to be just as it is for week 1, but for week 2, I need to include
weeks
1&2, week 3 to include 1-3 and week 4 to include 1-4. Then it starts over
after week 4. I can do by changing the formula weekly in the following
way.
=SUMIF('weekly dates'!A1:AZ1,""&A5-8,Details!L7:BK7) week2
=SUMIF('weekly dates'!A1:AZ1,""&A5-16,Details!L7:BK7) week3
=SUMIF('weekly dates'!A1:AZ1,""&A5-24,Details!L7:BK7) week4

I know there has to be a cleaner and more correct way of doing this. Any
ideas?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMIF statement with AND statement Eric D Excel Discussion (Misc queries) 2 July 14th 08 07:24 PM
sumif statement Karen Smith Excel Discussion (Misc queries) 4 October 20th 06 06:39 PM
Sumif statement knbsmith11 Excel Discussion (Misc queries) 4 April 6th 06 06:01 PM
Help please, IF statement/SUMIF statement Brad_A Excel Worksheet Functions 23 January 11th 05 02:24 PM
sumif statement Ted Metro Excel Worksheet Functions 1 January 7th 05 04:18 PM


All times are GMT +1. The time now is 08:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"