SUMPRODUCT and blanks gives #VALUE!

Eddyke

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

I've build an array with (among more) dates and amonts. In the date list there is a formula, namely when the date matches a certain condition, then this date becomes blank (being "").

The intention is to show the last amount of a certain year. This amount can be in March but can also be in September or December, for example.

The dates are in column A, the amounts in column F. The condition year is in cell J11.

So, when I want to find the amount, I'm using the following formula:

SUMPRODUCT(--(A12:A500=MAX(IF(YEAR(A11:A500)=J12;A11:A500)));F11:F500)

However, everytime, I received as a result #VALUE!

I've tried several ways and noticed that the following formula works very well: SUMPRODUCT(--($A$11:$A$23=MAX(IF(YEAR($A$11:INDIRECT(ADDRESS(500-COUNTBLANK($A$11:$A$500);1)))=J11;$A$11:INDIRECT(ADDRESS(500-COUNTBLANK($A$11:$A$500);1)))));$F$11:$F$23) The problem however is that in this example the blank is in cell A24 and then I'm getting this #VALUE! error.

How can I solve this?

Thanks a lot!

 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Your ranges need to be the same size. Assuming that your data starts at Row 11, try...

Excel Formula:
=SUMPRODUCT(--(A11:A500=MAX(IF(YEAR(A11:A500)=J12;A11:A500)));F11:F500)

Hope this helps!
 
Upvote 0
Your ranges need to be the same size. Assuming that your data starts at Row 11, try...

Excel Formula:
=SUMPRODUCT(--(A11:A500=MAX(IF(YEAR(A11:A500)=J12;A11:A500)));F11:F500)

Hope this helps!
Hi Domenic,

Thanks for your reply!

Just tried it ... but unfortunately this doesn't work. I still got the #VALUE! error. The problem is that the formula works until the date is a blank (""), after that, I'm getting the error.

Best regards,
 
Upvote 0
In that case, try...

Excel Formula:
=SUMPRODUCT(--(A11:A500=MAX(IF(ISNUMBER(A11:A500);IF(YEAR(A11:A500)=J12;A11:A500))));F11:F500)

Hope this helps!
 
Upvote 0
Solution
In that case, try...

Excel Formula:
=SUMPRODUCT(--(A11:A500=MAX(IF(ISNUMBER(A11:A500);IF(YEAR(A11:A500)=J12;A11:A500))));F11:F500)

Hope this helps!
Great!
This works.
Thanks a lot!!
 
Upvote 0
You're very welcome, glad I could help.

Cheers!
 
Upvote 0
Note that in the futute when marking posts as the solution, please post the post that first answered the question, not your post acknowledging that some other post is the solution.
I have updated this for you on this thread.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,692
Messages
6,126,228
Members
449,303
Latest member
grantrob

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