Number rows but reset after a blank cell is encountered

excel_2009

Active Member
Joined
Sep 14, 2009
Messages
318
Hi Excel gurus,

I have the following formula which assigns a number to a cell

Code:
=IF(E2="","",COUNTA($E$2:E2))

It works great however I have a small issue in relation to when a blank value is in a cell, I'd like for the numbers to reset to 1 and increment (instead of continuing to increment irresepctive of coming across a blank cell):

Desired result:


[TABLE="width: 500"]
<tbody>[TR]
[TD]COLUMN E
[/TD]
[TD]FORMULA COLUMN
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]E
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]G
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]H
[/TD]
[TD]4
[/TD]
[/TR]
[TR]
[TD]I
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Y
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]U
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]I
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Instead of the following current issue:

[TABLE="width: 500"]
<tbody>[TR]
[TD]COLUMN E
[/TD]
[TD]FORMULA COLUMN
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]B
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]C
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]E
[/TD]
[TD]4
[/TD]
[/TR]
[TR]
[TD]D
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]G
[/TD]
[TD]6
[/TD]
[/TR]
[TR]
[TD]H
[/TD]
[TD]7
[/TD]
[/TR]
[TR]
[TD]I
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Y
[/TD]
[TD]9
[/TD]
[/TR]
[TR]
[TD]U
[/TD]
[TD]10
[/TD]
[/TR]
[TR]
[TD]I
[/TD]
[TD]11
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Please can someone help? :)
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Maybe..
Excel Workbook
EFG
1Header*Header
2A*1
3B*2
4C*3
5D*4
6***
7E*1
8F*2
9***
3



Hope that helps.
 
Upvote 0
Hi Howard,

I've tried the formulas but the results are not as expected, there are instances of numbers being duplicated and the value does not reset when a blank is encountered? is it possible to use one formula and drag that down?
 
Upvote 0
Hi Howard,

I've tried the formulas but the results are not as expected, there are instances of numbers being duplicated and the value does not reset when a blank is encountered? is it possible to use one formula and drag that down?

Seems to work on my sheet.

Howard


Excel 2012
EF
111
2q2
333
4 
551
6x2
773
884
995
10 
11111
12w2
13133
14 
15q1
16w2
17w3
18 
19q1
20w2
21e3
Sheet4
Cell Formulas
RangeFormula
F1=IF(E1<>0,1,"")
F2=IFERROR(IF(E2<>0,F1+1,""),1)
F3=IFERROR(IF(E3<>0,F2+1,""),1)
F4=IFERROR(IF(E4<>0,F3+1,""),1)
F5=IFERROR(IF(E5<>0,F4+1,""),1)
F6=IFERROR(IF(E6<>0,F5+1,""),1)
F7=IFERROR(IF(E7<>0,F6+1,""),1)
F8=IFERROR(IF(E8<>0,F7+1,""),1)
F9=IFERROR(IF(E9<>0,F8+1,""),1)
F10=IFERROR(IF(E10<>0,F9+1,""),1)
F11=IFERROR(IF(E11<>0,F10+1,""),1)
F12=IFERROR(IF(E12<>0,F11+1,""),1)
F13=IFERROR(IF(E13<>0,F12+1,""),1)
F14=IFERROR(IF(E14<>0,F13+1,""),1)
F15=IFERROR(IF(E15<>0,F14+1,""),1)
F16=IFERROR(IF(E16<>0,F15+1,""),1)
F17=IFERROR(IF(E17<>0,F16+1,""),1)
F18=IFERROR(IF(E18<>0,F17+1,""),1)
F19=IFERROR(IF(E19<>0,F18+1,""),1)
F20=IFERROR(IF(E20<>0,F19+1,""),1)
F21=IFERROR(IF(E21<>0,F20+1,""),1)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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