Count the number of "TRUE" cells in an adjacent field in a table?

Mr. Snrub

Board Regular
Joined
May 22, 2005
Messages
147
Office Version
  1. 365
Platform
  1. Windows
I have an Excel table with a field called TradingDay that simply stores Boolean values of whether a given date is a trading day. I used the formula described here to get whether the date is a trading day or not:

https://exceljet.net/formula/date-is-workday

Now I want to create a new field called TradingDayCount that counts the number of current trading days up to and including the current row, like so:

<table>
<tr>
<th>Date</th>
<th>TradingDay</th>
<th>TradingDayCount</th>
</tr>
<tr>
<td>1/1/2019</td>
<td>FALSE</td>
<td> </td>
</tr>
<tr>
<td>1/2/2019</td>
<td>TRUE</td>
<td>1</td>
</tr>
<tr>
<td>1/3/2019</td>
<td>TRUE</td>
<td>2</td>
</tr>
<tr>
<td>1/4/2019</td>
<td>TRUE</td>
<td>3</td>
</tr>
<tr>
<td>1/5/2019</td>
<td>FALSE</td>
<td> </td>
</tr>
<tr>
<td>1/6/2019</td>
<td>FALSE</td>
<td> </td>
</tr>
<tr>
<td>1/7/2019</td>
<td>TRUE</td>
<td>4</td>
</tr>
<tr>
<td>1/8/2019</td>
<td>TRUE</td>
<td>5</td>
</tr>
</table>


How do I do this?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Put this in cell C2 and copy down

=IF(B2,COUNTIF($B$2:B2,TRUE),"")
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

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