Sum(If(Year) and (Month) formula help needed

pbt

Well-known Member
Joined
Oct 18, 2005
Messages
1,613
Good morning folks,

I have the following wooksheets;
Sheet 1
Test Formula.xls
JKLM
21/16/2006$5,878.20
31/17/2006$5,402.20
41/8/2007$5,511.20
52/17/2006$5,983.00
62/18/2007$5,330.85
73/17/2006$5,125.20
83/18/2007$5,775.40
94/17/2006$6,074.75
105/17/2006$6,614.30
115/18/2007$5,878.20
126/7/2006$4,212.20
136/8/2007$5,415.20
Sheet1


Sheet 2
Test Formula.xls
ABCD
1CurrentYearCurrentYear+1
2
3JAN$11,280.40$5,511.20
4FEB$5,983.00$5,330.85
5MAR$5,125.20$5,775.40
Sheet2


The formulas on Sheet to continue for all twelve months.

What I am looking for, in col B, is something to replace =2006 to "current year" and col D, =2007 to"current year +1.

Also the range of 1470 is an abitrary number at this time. I would need the formula to look at the whole column because length of data may be greater than 1470 rows.

I have tried $J2:$J but that does not work. Don't know if this is an Index issue. Not well veresed on Index.

Any help appreciated.

Thanks
h.h.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try this in B3

=SUM(IF(YEAR(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,J:J)))=YEAR(TODAY()),IF(MONTH(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,J:J)))=1,INDIRECT("Sheet1!$K$2:$K$"&MATCH(9.99999999E+307,K:K)))))

and this in C3

=SUM(IF(YEAR(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,J:J)))=YEAR(TODAY())+1,IF(MONTH(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,J:J)))=1,INDIRECT("Sheet1!$K$2:$K$"&MATCH(9.99999999E+307,K:K)))))
 
Upvote 0
B1, copied across:

=YEAR(TODAY())+ROWS($B$1:B1)-1

B3, copied across & down:

=SUMPRODUCT(--(Sheet1!$J$2:$J$1470-DAY(Sheet1!$J$2:$J$1470)+1=("1-"&$A3&"-"&B$1)+0),Sheet1!$K$2:$K$1470)

If you are on Excel 2003, convert the data area on Sheet1 into a List by means of Data|List|Create List. This allow the formulas on Sheet2 to automatically update.
 
Upvote 0
My apologies guys, I may have confused the situation by trying to build a sheet that I thought would read better.

Row 1 is not actually there. I just put it there for clarity.

This is the actual sheets with the formulas:
This one for 2006 (will change to Current Year)
SCSP 2006 FORECAST test 7.xls
ABCDE
1JANAURYLHSTRETENTIONTOTAL
2DELWEBBSUNCITY11,280.4010,976.003,723.8025,980.20
3FUTURE10.00
4FUTURE20.00
5TOTAL25,980.20
6FEBRUARY
7DELWEBBSUNCITY0.000.001,823.151,823.15
8FUTURE10.00
9FUTURE20.00
10TOTAL1,823.15
11MARCH
12DELWEBBSUNCITY5,125.205,488.000.0010,613.20
13FUTURE10.00
14FUTURE20.00
15TOTAL10,613.20
RECAP 2006

This one for 2007 (will change to Current Year +1)
SCSP 2006 FORECAST test 7.xls
ABCDE
1JANAURYLHSTRETENTIONTOTAL
2DELWEBBSUNCITY11,494.209,548.00548.8021,591.00
3FUTURE10.00
4FUTURE20.00
5TOTAL21,591.00
6FEBRUARY
7DELWEBBSUNCITY5,330.850.000.005,330.85
8FUTURE10.00
9FUTURE20.00
10TOTAL5,330.85
11MARCH
12DELWEBBSUNCITY5,775.4011,372.500.0017,147.90
13FUTURE10.00
14FUTURE20.00
15TOTAL17,147.90
RECAP 2007


NBVC ~ I got a #N/A with your formula. Tried Enter and Sht/Ctrl Enter

Aladin ~ =YEAR(TODAY())+ROWS($B$1:B1)-1 gave me 2006 in every cell copied across

I don't think that I need that onless I have to "hide" it somewhere out of sight.

I am using Excel 2003, and your other formula works with or without converting data to List. Provided B1 has a date.

Thanks
h.h.
 
Upvote 0
I see where I went wrong...I didn't reference Sheet 1 in my Match() formulas

Please try:

=SUM(IF(YEAR(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,Sheet1!J:J)))=YEAR(TODAY()),IF(MONTH(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,Sheet1!J:J)))=ROW()-2,INDIRECT("Sheet1!$K$2:$K$"&MATCH(9.99999999E+307,Sheet1!J:J)))))

and

=SUM(IF(YEAR(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,Sheet1!J:J)))=YEAR(TODAY())+1,IF(MONTH(INDIRECT("Sheet1!$J$2:$J$"&MATCH(9.99999999E+307,Sheet1!J:J)))=ROW()-2,INDIRECT("Sheet1!$K$2:$K$"&MATCH(9.99999999E+307,Sheet1!J:J)))))
 
Upvote 0
NBVC ~ Your first formula is summing the whole column. I'm after just summing Month values (Jan, Feb, etc.) for the year.
B3 Jan, B4 Feb, B5 Mar

Second formula returns 0

Aladin ~ Your formulas work, provided I put =YEAR(TODAY())+COLUMNS($B$1:B1)-1 somewhere for it to reference.
(Change PC settings to test for 2007, 2008, & 2009)

Would that have to be my solution for this? And I did not have to change data to List.

Thanks
h.h.
 
Upvote 0
NBVC ~ Your first formula is summing the whole column. I'm after just summing Month values (Jan, Feb, etc.) for the year.
B3 Jan, B4 Feb, B5 Mar

Second formula returns 0

Aladin ~ Your formulas work, provided I put =YEAR(TODAY())+COLUMNS($B$1:B1)-1 somewhere for it to reference.
(Change PC settings to test for 2007, 2008, & 2009)

Would that have to be my solution for this? And I did not have to change data to List.

Thanks
h.h.

Harry,

If you have the setup you initially suggested and you make use of the List functionality, no doubt you'll enjoy its benefits.
 
Upvote 0
Based on your original information, my seem to work:
Book3
JKLM
1
21/16/2006$5,878.20
31/17/2006$5,402.20
41/8/2007$5,511.20
52/17/2006$5,983.00
62/18/2007$5,330.85
73/17/2006$5,125.20
83/18/2007$5,775.40
94/17/2006$6,074.75
105/17/2006$6,614.30
115/18/2007$5,878.20
126/7/2006$4,212.20
136/8/2007$5,415.20
Sheet1
Book3
ABCD
1
220062007
3January11280.45511.2
4February59835330.85
5March5125.25775.4
6
Sheet2
 
Upvote 0

Forum statistics

Threads
1,221,622
Messages
6,160,887
Members
451,676
Latest member
Assy Bissy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top