![]() |
creating a running tally
hi,
I have a list of names in column B, i want to write something that basically puts a number in column a if there is an entry in B so i have a running count e 1 AB 2 FG 3 XY any ideas pls. |
creating a running tally
Hi
the following formulas will put a sequencing number in column A, if column B is filled: in A1 enter the following formula =IF(B1<"",1,"") in A2 enter the formula =IF(B2<"",MAX($A$1:OFFSET($A2,-1,0))+1,"") and copy this formula down for as many rows as you like -- Regards Frank Kabel Frankfurt, Germany "kevin" schrieb im Newsbeitrag ... hi, I have a list of names in column B, i want to write something that basically puts a number in column a if there is an entry in B so i have a running count eg 1 ABC 2 FGH 3 XYZ any ideas pls. |
creating a running tally
Hi Kevin
one way: Sub increment_rows() Dim RowNdx As Long Dim LastRow As Long Dim counter As Long Application.ScreenUpdating = False counter = 1 LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row For RowNdx = 1 To LastRow With Cells(RowNdx, "B") If .Value < "" Then .Offset(0, -1).Value = counter counter = counter + 1 End If End With Next RowNdx Application.ScreenUpdating = True End Sub also deals with blanks rows in between (they are skipped) -- Regards Frank Kabel Frankfurt, Germany "kevin" schrieb im Newsbeitrag ... sorry i should have said i am looking for a piece of code that does the same thing, like a loop that says if b has a value then a is cell above + 1 next i type thing. i am a novice but i know the code is relatively simple just don't know it. thanks in advance. |
All times are GMT +1. The time now is 02:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com