# Counting Unique Number of Days

#### Smokeyham

##### Board Regular
I have a table with a large number of readings. Multiple readings are taken per day. I am trying to count the number of each week day on which we have taken readings, for instance "How many Saturdays have we been taking readings on."

I have the dates entered into Column A.

I tried the array formula =SUM(--(WEEKDAY(A1:A200)=7)) Where "7" represents Saturdays, but this gives me very high results. I suspect it is just counting all rows where the day is a Saturday.

Any suggestions?

Many thanks.

Gordon

#### Momentman

##### Well-known Member
Something like this maybe

##### MrExcel MVP
Would you post a small sample along with the desired output?

#### Smokeyham

##### Board Regular
Something like this maybe

</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">E2</th><td style="text-align:left">=SUMPRODUCT(<font color="Blue">(<font color="Red">1/COUNTIF(<font color="Green">\$B\$2:\$B\$36,\$B\$2:\$B\$36</font>)</font>)*(<font color="Red">WEEKDAY(<font color="Green">\$B\$2:\$B\$36,2</font>)=7</font>)</font>)</td></tr></tbody></table></td></tr></table><br />
Thank you! That worked!

One interesting thing is that when I substitute the specified range (=SUMPRODUCT((1/COUNTIF(\$A\$2:\$A\$349,\$A\$2:\$A\$349))*(WEEKDAY(\$A\$2:\$A\$349,2)=T3))

with a named range (=SUMPRODUCT((1/COUNTIF(ObsCount[[#All],[Date]],ObsCount[[#All],[Date]]))*(WEEKDAY(ObsCount[[#All],[Date]],2)=T2))

I get a syntax error. The reference at the end of the equation (T2 or T3) is a reference to a cell with the day number.

#### Smokeyham

##### Board Regular
Thank you! That worked!

One interesting thing is that when I substitute the specified range (=SUMPRODUCT((1/COUNTIF(\$A\$2:\$A\$349,\$A\$2:\$A\$349))*(WEEKDAY(\$A\$2:\$A\$349,2)=T3))

with a named range (=SUMPRODUCT((1/COUNTIF(ObsCount[[#All],[Date]],ObsCount[[#All],[Date]]))*(WEEKDAY(ObsCount[[#All],[Date]],2)=T2))

I get a syntax error. The reference at the end of the equation (T2 or T3) is a reference to a cell with the day number.

Found the solution to the syntax error. If you run across this, just be sure to only choose data within your named column (not including the header row). Here is the updated version of the formula, which works.

=SUMPRODUCT((1/COUNTIF(ObsCount[Date],ObsCount[Date]))*(WEEKDAY(ObsCount[Date],2)=E17)). Notice the absence of "[#ALL]" in the formula.

1,081,417
Messages
5,358,553
Members
400,503
Latest member
RedSquirrel

### This Week's Hot Topics

• VBA (Userform)
Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
• List box that changes fill color
Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
• Remove duplicates and retain one. Cross-linked cases
Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
• VBA Copy and Paste With Duplicates
Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
• Macro
is it possible for a macro to run if the active cell value is different to the value above it
• IF DATE and TIME
I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...