#1   Report Post  
benb
 
Posts: n/a
Default SUMPRODUCT help

I'm still learning all the capabilities of the SUMPRODUCT function and need
help adapting it to my current purpose. I have a column of dates, and I am
trying to obtain a MTD total from corresponding column of values. I figured
there is probably a way of nesting a MONTH function within the SUMPRODUCT to
do this. Using a date range would be a round about way of accomplishing
this, but I'd rather be able to define the month by referring to a single
cell with today's date (or the date I am reporting on). My failed attempt
looked something like this:

=SUMPRODUCT((Z:Z)*(MONTH($B:$B)=MONTH($A$7))*(YEAR ($B:$B)=YEAR($A$7)))

My guess is that I need to be using an array function, but Ctrl+Shift+Enter
is no help.

Thanks in advance. I always try to return the favor, but it seems like no
matter what I get more help from you all than I am able to offer myself.


  #2   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

1. You can't use the whole column like in B:B in any array formula, if you
want to sum what's in Z where B is year and month form A7? One way would be

=SUMPRODUCT(--(YEAR($B$1:$B$1000)=YEAR($A$7)),--(MONTH($B$1:$B$1000)=MONTH($A$7)),$Z$1:$Z$1000)

if you want to sum everything in Z where B is earlier than A7 use

=SUMPRODUCT(--($B$1:$B$1000<$A$7),$Z$1:$Z$1000)

both entered normally


Regards,

Peo Sjoblom

"benb" wrote:

I'm still learning all the capabilities of the SUMPRODUCT function and need
help adapting it to my current purpose. I have a column of dates, and I am
trying to obtain a MTD total from corresponding column of values. I figured
there is probably a way of nesting a MONTH function within the SUMPRODUCT to
do this. Using a date range would be a round about way of accomplishing
this, but I'd rather be able to define the month by referring to a single
cell with today's date (or the date I am reporting on). My failed attempt
looked something like this:

=SUMPRODUCT((Z:Z)*(MONTH($B:$B)=MONTH($A$7))*(YEAR ($B:$B)=YEAR($A$7)))

My guess is that I need to be using an array function, but Ctrl+Shift+Enter
is no help.

Thanks in advance. I always try to return the favor, but it seems like no
matter what I get more help from you all than I am able to offer myself.


  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

also, take a look at http://xldynamic.com/source/xld.SUMPRODUCT.html

--
HTH

-------

Bob Phillips
"Peo Sjoblom" wrote in message
...
1. You can't use the whole column like in B:B in any array formula, if you
want to sum what's in Z where B is year and month form A7? One way would

be


=SUMPRODUCT(--(YEAR($B$1:$B$1000)=YEAR($A$7)),--(MONTH($B$1:$B$1000)=MONTH($
A$7)),$Z$1:$Z$1000)

if you want to sum everything in Z where B is earlier than A7 use

=SUMPRODUCT(--($B$1:$B$1000<$A$7),$Z$1:$Z$1000)

both entered normally


Regards,

Peo Sjoblom

"benb" wrote:

I'm still learning all the capabilities of the SUMPRODUCT function and

need
help adapting it to my current purpose. I have a column of dates, and

I am
trying to obtain a MTD total from corresponding column of values. I

figured
there is probably a way of nesting a MONTH function within the

SUMPRODUCT to
do this. Using a date range would be a round about way of accomplishing
this, but I'd rather be able to define the month by referring to a

single
cell with today's date (or the date I am reporting on). My failed

attempt
looked something like this:

=SUMPRODUCT((Z:Z)*(MONTH($B:$B)=MONTH($A$7))*(YEAR ($B:$B)=YEAR($A$7)))

My guess is that I need to be using an array function, but

Ctrl+Shift+Enter
is no help.

Thanks in advance. I always try to return the favor, but it seems like

no
matter what I get more help from you all than I am able to offer myself.




  #4   Report Post  
benb
 
Posts: n/a
Default

Thanks for your help. Out of curiousity, do you know why in my Excel I have
to put the array to be summed (e.g. $Z$1:$Z$1000) as the first argument when
everyone else seems to put it as the last argument? Is there something in
the settings I can change to be more in line with the norm?

"Peo Sjoblom" wrote:

1. You can't use the whole column like in B:B in any array formula, if you
want to sum what's in Z where B is year and month form A7? One way would be

=SUMPRODUCT(--(YEAR($B$1:$B$1000)=YEAR($A$7)),--(MONTH($B$1:$B$1000)=MONTH($A$7)),$Z$1:$Z$1000)

if you want to sum everything in Z where B is earlier than A7 use

=SUMPRODUCT(--($B$1:$B$1000<$A$7),$Z$1:$Z$1000)

both entered normally


Regards,

Peo Sjoblom

"benb" wrote:

I'm still learning all the capabilities of the SUMPRODUCT function and need
help adapting it to my current purpose. I have a column of dates, and I am
trying to obtain a MTD total from corresponding column of values. I figured
there is probably a way of nesting a MONTH function within the SUMPRODUCT to
do this. Using a date range would be a round about way of accomplishing
this, but I'd rather be able to define the month by referring to a single
cell with today's date (or the date I am reporting on). My failed attempt
looked something like this:

=SUMPRODUCT((Z:Z)*(MONTH($B:$B)=MONTH($A$7))*(YEAR ($B:$B)=YEAR($A$7)))

My guess is that I need to be using an array function, but Ctrl+Shift+Enter
is no help.

Thanks in advance. I always try to return the favor, but it seems like no
matter what I get more help from you all than I am able to offer myself.


  #5   Report Post  
benb
 
Posts: n/a
Default

Thanks Bob. I've looked at a few websites to try to learn more, and this has
to be the best-organized one I've seen so far.

"Bob Phillips" wrote:

also, take a look at http://xldynamic.com/source/xld.SUMPRODUCT.html

--
HTH

-------

Bob Phillips
"Peo Sjoblom" wrote in message
...
1. You can't use the whole column like in B:B in any array formula, if you
want to sum what's in Z where B is year and month form A7? One way would

be


=SUMPRODUCT(--(YEAR($B$1:$B$1000)=YEAR($A$7)),--(MONTH($B$1:$B$1000)=MONTH($
A$7)),$Z$1:$Z$1000)

if you want to sum everything in Z where B is earlier than A7 use

=SUMPRODUCT(--($B$1:$B$1000<$A$7),$Z$1:$Z$1000)

both entered normally


Regards,

Peo Sjoblom

"benb" wrote:

I'm still learning all the capabilities of the SUMPRODUCT function and

need
help adapting it to my current purpose. I have a column of dates, and

I am
trying to obtain a MTD total from corresponding column of values. I

figured
there is probably a way of nesting a MONTH function within the

SUMPRODUCT to
do this. Using a date range would be a round about way of accomplishing
this, but I'd rather be able to define the month by referring to a

single
cell with today's date (or the date I am reporting on). My failed

attempt
looked something like this:

=SUMPRODUCT((Z:Z)*(MONTH($B:$B)=MONTH($A$7))*(YEAR ($B:$B)=YEAR($A$7)))

My guess is that I need to be using an array function, but

Ctrl+Shift+Enter
is no help.

Thanks in advance. I always try to return the favor, but it seems like

no
matter what I get more help from you all than I am able to offer myself.







  #6   Report Post  
Ken Wright
 
Posts: n/a
Default

=SUMIF(A:A,"<="&TODAY(),B:B)-SUMIF(A:A,"<"&DATE(YEAR(TODAY()),MONTH(TODAY())
,1),B:B)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"benb" wrote in message
...
I'm still learning all the capabilities of the SUMPRODUCT function and

need
help adapting it to my current purpose. I have a column of dates, and I

am
trying to obtain a MTD total from corresponding column of values. I

figured
there is probably a way of nesting a MONTH function within the SUMPRODUCT

to
do this. Using a date range would be a round about way of accomplishing
this, but I'd rather be able to define the month by referring to a single
cell with today's date (or the date I am reporting on). My failed attempt
looked something like this:

=SUMPRODUCT((Z:Z)*(MONTH($B:$B)=MONTH($A$7))*(YEAR ($B:$B)=YEAR($A$7)))

My guess is that I need to be using an array function, but

Ctrl+Shift+Enter
is no help.

Thanks in advance. I always try to return the favor, but it seems like no
matter what I get more help from you all than I am able to offer myself.




  #7   Report Post  
Harlan Grove
 
Posts: n/a
Default

Ken Wright wrote...
=SUMIF(A:A,"<="&TODAY(),B:B)-SUMIF(A:A,"<"&DATE(YEAR(TODAY()),
MONTH(TODAY()),1),B:B)


It's a lot easier to calculate the firzt day of the current month as

TODAY()-DAY(TODAY())+1

Using this, a shorter alternative,
=SUMIF(A:A,""&(TODAY()-DAY(TODAY())),B:B)-SUMIF(A:A,""&TODAY(),B:B)

  #8   Report Post  
Ken Wright
 
Posts: n/a
Default

Cheers Harlan - hadn't even considered using DAY() to try and get there.
However, now you've gotten me there, in theory if it was a real MTD figure
then I guess it should be covered by just the first part of that

=SUMIF(A:A,""&(TODAY()-DAY(TODAY())),B:B)

Now if he'd only not thrown in that bit about "or the date I'm reporting
on" <g

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Harlan Grove" wrote in message
oups.com...
Ken Wright wrote...
=SUMIF(A:A,"<="&TODAY(),B:B)-SUMIF(A:A,"<"&DATE(YEAR(TODAY()),
MONTH(TODAY()),1),B:B)


It's a lot easier to calculate the firzt day of the current month as

TODAY()-DAY(TODAY())+1

Using this, a shorter alternative,
=SUMIF(A:A,""&(TODAY()-DAY(TODAY())),B:B)-SUMIF(A:A,""&TODAY(),B:B)



  #9   Report Post  
benb
 
Posts: n/a
Default

Thanks for your help. The using reporting date rather than today's date
actually wasn't a problem with the formula you all provided. Thanks again.

"Ken Wright" wrote:

Cheers Harlan - hadn't even considered using DAY() to try and get there.
However, now you've gotten me there, in theory if it was a real MTD figure
then I guess it should be covered by just the first part of that

=SUMIF(A:A,""&(TODAY()-DAY(TODAY())),B:B)

Now if he'd only not thrown in that bit about "or the date I'm reporting
on" <g

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Harlan Grove" wrote in message
oups.com...
Ken Wright wrote...
=SUMIF(A:A,"<="&TODAY(),B:B)-SUMIF(A:A,"<"&DATE(YEAR(TODAY()),
MONTH(TODAY()),1),B:B)


It's a lot easier to calculate the firzt day of the current month as

TODAY()-DAY(TODAY())+1

Using this, a shorter alternative,
=SUMIF(A:A,""&(TODAY()-DAY(TODAY())),B:B)-SUMIF(A:A,""&TODAY(),B:B)




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
Another Sumproduct & #N/A problem Dave Davis Excel Worksheet Functions 3 January 10th 05 03:59 PM
SUMPRODUCT Gerrym Excel Worksheet Functions 1 January 4th 05 11:48 AM
Sumproduct ... Empty Cells vs Spaces? Ken Excel Discussion (Misc queries) 9 December 17th 04 08:03 PM
Sumproduct function not working Scott Summerlin Excel Worksheet Functions 12 December 4th 04 05:15 AM
adding two sumproduct formulas together ski2004_2005 Excel Worksheet Functions 1 November 12th 04 09:08 PM


All times are GMT +1. The time now is 07:16 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"