COUNTA with IF function

UberFrank

Board Regular
Joined
Jul 8, 2010
Messages
51
I have two columns of data, Colums A containing a list of dates in July and Column B containing either data or no data. I need to return the number of Rows in B that contain data for each day in the month.

Have tried sum product to no avail as well as diferent combinations of COUNTA with IF and COUNTIF. Any idea?

Many thanks in advance.
 

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).

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,710
Perhaps like:

Sheet1

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Calibri,Arial; FONT-SIZE: 11pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 75px"><COL style="WIDTH: 64px"><COL style="WIDTH: 19px"><COL style="WIDTH: 75px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt; FONT-WEIGHT: bold"><TD></TD><TD>A</TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">1</TD><TD>Date</TD><TD>Data</TD><TD></TD><TD>Date</TD><TD>Data Count</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">2</TD><TD style="TEXT-ALIGN: right">01/07/2010</TD><TD>Data1</TD><TD></TD><TD style="TEXT-ALIGN: right">01/07/2010</TD><TD style="TEXT-ALIGN: right">4</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">3</TD><TD style="TEXT-ALIGN: right">01/07/2010</TD><TD>Data2</TD><TD></TD><TD style="TEXT-ALIGN: right">02/07/2010</TD><TD style="TEXT-ALIGN: right">3</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">4</TD><TD style="TEXT-ALIGN: right">01/07/2010</TD><TD>Data3</TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">5</TD><TD style="TEXT-ALIGN: right">01/07/2010</TD><TD></TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">6</TD><TD style="TEXT-ALIGN: right">01/07/2010</TD><TD>Data5</TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">7</TD><TD style="TEXT-ALIGN: right">02/07/2010</TD><TD></TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">8</TD><TD style="TEXT-ALIGN: right">02/07/2010</TD><TD>Data7</TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">9</TD><TD style="TEXT-ALIGN: right">02/07/2010</TD><TD>Data8</TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">10</TD><TD style="TEXT-ALIGN: right">02/07/2010</TD><TD>Data9</TD><TD></TD><TD></TD><TD></TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">11</TD><TD style="TEXT-ALIGN: right">02/07/2010</TD><TD></TD><TD></TD><TD></TD><TD></TD></TR></TBODY></TABLE>
<TABLE style="BORDER-BOTTOM-STYLE: groove; BORDER-BOTTOM-COLOR: #00ff00; BORDER-RIGHT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-TOP-STYLE: groove; COLOR: #000000; BORDER-RIGHT-COLOR: #00ff00; FONT-SIZE: 10pt; BORDER-LEFT-STYLE: groove; BORDER-LEFT-COLOR: #00ff00"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-FAMILY: Arial; FONT-SIZE: 9pt" border=1 cellSpacing=0 cellPadding=2><TBODY><TR style="BACKGROUND-COLOR: #cacaca; FONT-SIZE: 10pt"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>E2</TD><TD>=SUMPRODUCT(--(A$2:A$11=D2),--(B2:B11<>""))</TD></TR><TR><TD>E3</TD><TD>=SUMPRODUCT(--(A$2:A$11=D3),--(B3:B12<>""))</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
Matty
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
55,039
Office Version
  1. 365
Platform
  1. Windows
If the data is (or can be) sorted by date, what about using Excel's built-in Subtotal feature?

Excel Workbook
AB
1DateData
201/07/2010Data1
301/07/2010Data2
401/07/2010Data3
501/07/2010
601/07/2010Data5
701/07/2010 Count4
802/07/2010
902/07/2010Data7
1002/07/2010Data8
1102/07/2010Data9
1202/07/2010
1302/07/2010 Count3
14Grand Count7
Sub Total
 

UberFrank

Board Regular
Joined
Jul 8, 2010
Messages
51
Both work perfectly, Matty that was exactly what i was after.


Thank you both

The Frank
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
55,039
Office Version
  1. 365
Platform
  1. Windows
Another built-in feature (Pivot Tbale) would also be perfect for this (even if the data is not sorted by date). The Pivot Table formatting does not show that well in Excel jeanie but would be fine on your sheet.

Excel Workbook
ABCDEF
1DateDataCount of Data
201/07/2010Data1DateTotal
302/07/2010Data801/07/20104
401/07/2010Data302/07/20103
502/07/2010Data9Grand Total7
601/07/2010Data5
702/07/2010
801/07/2010
902/07/2010Data7
1001/07/2010Data2
1102/07/2010
12
Sub Total
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,108
Messages
5,857,431
Members
431,879
Latest member
KiwDaWabbit

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
Top