# sequential numbering

i would like count the number value in column g.see the attached workbook
seqBook1.xls
Asked:
###### Who is Participating?

Excel VBA DeveloperCommented:
If you want your described pattern - where the value in F increments only if a value in G exists with a blank cell below -  insert a "1" in cell F20, then insert this formula in cell F21 and copy down:
=IF(G21="",F20,IF(G22<>"",F20,F20+1))

Regards,
-Glenn
0

Commented:
Did you mean this pattern?  (Every time a non-empty value appears in column G, the value in column E increases)
``````1		503
1
1
1
1
1
1
2		515
2
2
2
3		115
4		101
``````
0

Commented:
If so, then put this formula in E21 and fill down
``````=E20+(LEN(G21)<>0)
``````
0

Finance AnalystCommented:
How about this instead in E20:

=IF(G19<>"",E19,COUNT(G\$20:G20))

copied down as far as required down column E.

Thanks
Rob H
0

Excel VBA DeveloperCommented:
Rob, it doesn't work. :-(  After a pair of values, it increments after the second blank cell.

See example.
EE-seqBook1.xls
0

Finance AnalystCommented:
Aagh, only tried it down as far as first pair.

Thanks
Rob H
0

Commented:
No one is giving any attention to the first and simplest formula?  I feel like Rodney Dangerfield -- no respect at all.
0

Excel VBA DeveloperCommented:
Heh...I added your formula to the example workbook, too, aikimark.  Yours increments with each occurrence of a value in column G; not exactly what the user asked for.  No disrespect meant. :-)
0

Commented:
@Glenn

That is why I posted a different version of the result data.  There was a discordance between the description of the problem and the posted sample data.
0

Excel VBA DeveloperCommented:
@aikimark,
I agree that your formula is indeed the simplest and most-logical when wanting to display a continuous, incrementing count by values in another column.  But the questioner wrote in the workbook:

I would like to do sequential numbering in column e , where the numbers fall together eg. Row 32,115 and row 33 100 I would like row 31 to have the sam sequential number as the previous

There's some transcription issues here, but re-written to match the actual example data:

I would like to do sequential numbering in column E where the numbers fall together eg. Row 31, 115 and row 32 101, I would like row 31 to have the same sequential number as the previous [value].

And it does include an example of how the sequence should be displayed that agrees with this statement.

Just need the questioner to get back in here and clear it all up for us!

-Glenn
0

Commented:
@Glenn

Without some algorithmic rule to determine whether the number is incremented or not, the problem is unsolvable for any instance (configuration and amount of data) but this one.  Such a solution is too trivial for anything but a manual process.
0

Author Commented:
glen's formula is exactly what i am looking for =IF(G21="",F20,IF(G22<>"",F20,F20+1))
i am using the formula to alternate shade the worksheet,i just use the mod function in the populated column and everything is fine
0

Commented:
@Svgmassive

Can you explain the algorithm?  Why does the 115 row still have the number 2 as opposed to the number 3?  I asked about this way back in comment http:#a40221380
I would like an answer.
0

Excel VBA DeveloperCommented:
Svgmassive, if you're looking for a contextual method for alternating shading rows, you should read my article on Conditional Formatting; it covers just this type of method.

-Glenn
0

Excel VBA DeveloperCommented:
Hi svgmassive,

If my original solution is acceptible, can you please properly close this question by clicking the "Accept this solution" link above that submission (not this post).  This will help ensure that future searches are meaningful to other EE members.

If you still have issues or questions, please let me know.

Thanks,
-Glenn
0

Author Commented:
great
0

Commented:
@svgmassive

Please answer my question about the numbering.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Already a member? Login.

All Courses

From novice to tech pro — start learning today.