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.
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

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
45,926
Office Version
365
Platform
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
45,926
Office Version
365
Platform
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,855
Messages
5,513,796
Members
408,969
Latest member
abonae

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top