Counting rows based on data

nryan

Board Regular
Joined
Apr 3, 2015
Messages
61
Hello,

I'm trying to create a formula for column C in the examples below.
  • Column B is static, it never changes. I included it in case there's a clever way to use it that I'm not seeing.
  • Column A is input by the user.

I've been at it for a while and can't find a solution. Basically I want column C to start counting when the Column A has a value of 1 and continue counting until the last none zero value. There will never be more than 25 rows. Thanks in advance.

Example 1
ABCNotes
1Contact #Pin #Location #
2010
3121start counting
4232
5343
6054
7465
8076
9087
10098
110109
1201110
1301211
1401312
1501413
1601514
1701615
1801716
1901817
2001918
2102019
2252120
2362221
2472322
2582423stop counting
260250

<tbody>
</tbody>

Example 2
ABCNotes
1Contact #Pin #Location #
2010
3020
4131start counting
5242
6353
7064
8475
9586
10697
110108
120119
1371210
1481311
1591412
1601513
17101614
18111715
1901816
20131917
21142018
2202119
23152220
24162321stop counting
250240
260250

<tbody>
</tbody>
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

nryan

Board Regular
Joined
Apr 3, 2015
Messages
61
This works great! I like the way you used the SUM function to add a value of 1 to the value in the cell above. Lot cleaner than what I was doing. I think I understand what you did here with the AND and COUNTIF functions.

Thank you,
Nick
 

Watch MrExcel Video

Forum statistics

Threads
1,122,230
Messages
5,594,952
Members
413,954
Latest member
mrsandy

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