Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Tim
 
Posts: n/a
Default error with smproduct for January

Hi,

These formulas: "=SUMPRODUCT(--(MONTH(Calc!C4:Calc!C65536)
=B4))" and "=SUMPRODUCT(--(MONTH(Calc!C4:Calc!C65536)
=B4),Calc!M4:Calc!M65536)" work perfect for all months
except for January. The result if the month in C3 =1 is
always wrong. Columns "C"and"M"are updating periodically
by inserting a new row at the top of them. Can you help
me to fix this problem?

  #2   Report Post  
 
Posts: n/a
Default

A small correction i insert the month in B4 not in C3.
Tim

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Having empty cells in that range will cause trouble.

If you leave A1 empty, then put =month(a1), you'll see excel returns 1.

So you could check to see if the cell is non-empty in your formula.

=SUMPRODUCT(--(MONTH(calc!C4:C65536)=B4),--(calc!C4:C65536<""))

I wouldn't use this style: calc!c4:calc!c65536.

And if possible, I'd try to limit that range to something smaller (but large
enough!).




Tim wrote:

Hi,

These formulas: "=SUMPRODUCT(--(MONTH(Calc!C4:Calc!C65536)
=B4))" and "=SUMPRODUCT(--(MONTH(Calc!C4:Calc!C65536)
=B4),Calc!M4:Calc!M65536)" work perfect for all months
except for January. The result if the month in C3 =1 is
always wrong. Columns "C"and"M"are updating periodically
by inserting a new row at the top of them. Can you help
me to fix this problem?


--

Dave Peterson
  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

Just to add...

if A1 is empty, then =a1 will return a 0.

Excel keeps track of dates by counting the number of days since a base date
(usually Dec 31, 1899 for windows users).

If you put 0 in a cell, then format it as a custom date: dddd, mmmm dd, yyyy
You'll see:
Saturday, January 00, 1900

So empty cells/0 values are in January (well, for excel anyway!)



Dave Peterson wrote:

Having empty cells in that range will cause trouble.

If you leave A1 empty, then put =month(a1), you'll see excel returns 1.

So you could check to see if the cell is non-empty in your formula.

=SUMPRODUCT(--(MONTH(calc!C4:C65536)=B4),--(calc!C4:C65536<""))

I wouldn't use this style: calc!c4:calc!c65536.

And if possible, I'd try to limit that range to something smaller (but large
enough!).

Tim wrote:

Hi,

These formulas: "=SUMPRODUCT(--(MONTH(Calc!C4:Calc!C65536)
=B4))" and "=SUMPRODUCT(--(MONTH(Calc!C4:Calc!C65536)
=B4),Calc!M4:Calc!M65536)" work perfect for all months
except for January. The result if the month in C3 =1 is
always wrong. Columns "C"and"M"are updating periodically
by inserting a new row at the top of them. Can you help
me to fix this problem?


--

Dave Peterson


--

Dave Peterson
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



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