Sumproduct to countif

Akashwani

Well-known Member
Joined
Mar 14, 2009
Messages
2,911
Hi,

I want to count how many years (From date To date) include a particular year and return all relevant data.


Excel Workbook
ABCDE
1NameTransportColourFromTo
2BillBusRed02/02/200020/03/2004
3TomCarGreen02/02/200320/03/2004
4JoPlaneBlue02/02/200420/03/2006
5TimBoatYellow02/02/199920/03/2001
6SueTrainRed02/02/200220/03/2002
7DanBikeYellow02/02/200020/03/2001
8BobCarBlue02/02/200820/03/2009
9MoPlaneGreen02/02/200020/03/2002
10FloBusRed02/02/200220/03/2004
11JoePlaneGreen02/02/199920/03/2000
12JimBoatBlue02/02/200120/03/2002
13PatTrainRed02/02/200220/03/2002
Sheet1



Excel Workbook
ABCDEFG
1YearCount*****
22000644111
3*******
4NameTransportColourFromTo**
5BillBusRed02/02/200020/03/2004**
6TimBoatYellow02/02/199920/03/2001**
7DanBikeYellow02/02/200020/03/2001**
8MoPlaneGreen02/02/200020/03/2002**
9JoePlaneGreen02/02/199920/03/2000**
10#NUM!#NUM!#NUM!#NUM!#NUM!**
Sheet2




I know that I am doing something wrong with the Sumproduct formulas, but for the life of me I just cannot see it. The above Sumproduct needs to return 5, not 6 or 4 or 1 :rofl:

Can someone ease my mind?

Thanks

Ak
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi Biff,

I'm so sorry for wasting your time and for causing you any mental frustration with me. Look at it from the positive side Biff, you have spent 2 days banging your head on this project :rofl:

Thanks again Biff for your contributions, appreciated as always.

Ak
 
Upvote 0
Hi Biff,

I'm so sorry for wasting your time and for causing you any mental frustration with me. Look at it from the positive side Biff, you have spent 2 days banging your head on this project :rofl:

Thanks again Biff for your contributions, appreciated as always.

Ak
Nah, I'm not wasting my time!

Here's what confused me.

You posted this formula:

=SUMPRODUCT((YEAR(Sheet1!$D$2:$D$13)<=A2)+(YEAR(Sheet1!$E$2:$E$13)<=A2))

In that context the plus operator (+) means OR.

So, I interpreted it literally that you meant:

Count if the year in column D OR the year in column E is <=A2.
 
Upvote 0
Ah, you see Biff, that's the obvious difference between us, you know what your doing and what Excel means and I'm just making a complete hash of Excel and an *ss of myself :rofl:

Thanks

Ak
 
Upvote 0
Ah, you see Biff, that's the obvious difference between us, you know what your doing and what Excel means and I'm just making a complete hash of Excel and an *ss of myself :rofl:

Thanks

Ak
Look at it from my perspective...

Every minute you spend in forums like this you're learning and improving your skills! :)
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,277
Members
452,902
Latest member
Knuddeluff

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