Sumproduct returns #VALUE! when summing up values

Eddyke

New Member
Joined
Nov 7, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm having a small problem when summing up values in column G.

In column A, there is a list of dates. Depending on the value of J2 (where is mentioned the year) it should sum all values in column G that are related to that year.

However, sometimes there is no year known and then the value of the date in column A is blank (""). Those values should not be summed.

I've tried the following formula:

SUMPRODUCT(--(YEAR($A$2:$A$1000)=$J2);$G$2:$G$1000) ==> returns #VALUE!

So, I've tried to check if the values are blank with the following formulas:

SUMPRODUCT(--(YEAR(ISNUMBER($A$2:$A$1000))=$J2);$G$2:$G$1000) ==> returns 0

or SUMPRODUCT(--(ISNUMBER($A$2:$A$1000));--(YEAR($A$2:$A$1000)=$J2);$G$2:$G$1000) ==> returns #VALUE!

So, can please one of your experts help me in this matter?

Thanks a lot and have a nice day.

Best regards


So
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Would it not work better with Sumif:
Excel Formula:
=SUMIF($A$2:$A$1000,$J$2,$G$2:$G$1000)
 
Upvote 0
@Eddyke I suspect that one or more of the date cells that you assume to be blank actually contain a hidden character?
Eg a space.
Otherwise, there should be nothing wrong with your initial formula.
 
Upvote 0
@Eddyke I suspect that one or more of the date cells that you assume to be blank actually contain a hidden character?
Eg a space.
Otherwise, there should be nothing wrong with your initial formula.
Some date cells contains "". As a matter of fact, it is a formula which refers to another cell. Depending on a certain condition, it takes the date or a blank ""
Would it not work better with Sumif:
Excel Formula:
=SUMIF($A$2:$A$1000,$J$2,$G$2:$G$1000)
I've also tried that but unfortunately, in column A is a full date (e.g. 01/02/2022). Cell J2 contains only the year 2022. So if I try the formula SUMIF(year($A$2:$A$1000),$J$2,$G$2:$G$1000) then it seems that there is something wrong with this formula.
 
Upvote 0
Then it will be the YEAR function that is creating the error.

Try
Excel Formula:
=SUMPRODUCT(--(IFERROR(YEAR($A$2:$A$1000),0)=$J2),$G$2:$G$1000)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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