Counting Dates across rows

erniepoe

Active Member
Joined
Oct 23, 2006
Messages
375
Office Version
  1. 365
Platform
  1. Windows
Hi all, I am trying to find the number of dates in G1:C1 that equal the year of the cell in A1, but I am getting a value error. When I use this formula down columns rather than across rows, it seems to work fine. Is there a workaround to get this to work across rows?

=SUMPRODUCT(--(YEAR(G1:CM1)=YEAR(A1)))
 

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).
That formula works fine. Check that your dates are real dates & not text.
 
Upvote 0
N.B. Which range do you want to calculate, the range in the description or the range in the formula?
Ensure that you do not have text or error messages in the range.
Sum will also work.

T202310a.xlsm
ABCDEFGHIJK
18-Oct-235-May-2310-Oct-232-Feb-2322-May-2310-Oct-24
2
3
422
533
2d
Cell Formulas
RangeFormula
B4B4=SUMPRODUCT(--(YEAR(G1:CM1)=YEAR(A1)))
C4C4=SUM(--(YEAR(G1:CM1)=YEAR(A1)))
B5B5=SUMPRODUCT(--(YEAR(C1:G1)=YEAR(A1)))
C5C5=SUM(--(YEAR(C1:G1)=(YEAR(A1))))
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,400
Members
449,156
Latest member
LSchleppi

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