Sumproduct with Not Equal To Operators

skinfreak

Board Regular
Joined
May 23, 2003
Messages
152
I have a sumproduct formula which is causing me grief. The first works fine:

Code:
=SUMPRODUCT(--(Data!$G$5:$G$23000=$G1),--(YEAR(Data!$I$5:$I$23000)=B$3))

I also duplicate this but for the contents of cell G2. I also need the result of all other cells whose Year is equal to that of cell B3, but not equal to G1 or G2 even if it is blank.

I tried this, but it does not work:

Code:
=SUMPRODUCT(((Data!$G$5:$G$23000<>G1)+(Data!$G$5:$G$23000<>G2))*(YEAR(Data!$I$5:$I$23000)=Output!B$3))

What this probduces is a total which makes little sense to me. What I think it is doing is saying "count up if col G in sheet "Data" does not contain either G1 or G2, but if the date equals B3". Is this right?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Maybe


Code:
SUMPRODUCT(--(Data!$G$5:$G$23000<>G1),--(Data!$G$5:$G$23000<>G2),--(YEAR(Data!$I$5:$I$23000)=Output!B$3))

Pekka
:o :o :o
 
Upvote 0
You beauty!

Out of interest, how could I modify this to include a range of months for example? Jan-March, April-Jun etc...
 
Upvote 0

Forum statistics

Threads
1,225,101
Messages
6,182,834
Members
453,136
Latest member
fitzyseverton

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