ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sequential number within excel (https://www.excelbanter.com/excel-programming/357869-sequential-number-within-excel.html)

dev

Sequential number within excel
 
Please see the data below

a b c
000000080672 EI0G18 1.00
EIVH38 1.00
EIVK38 1.00
000000082585 EIRH69 1.00
EIRK69 1.00

the first 3 items in column B belongs to the first item in column a.
Accordingly the next 2 items in col "b" belongs to the next item in col "A".
I want to number the first item in col "A" as 1 and the 3 items in col "B" as
1.1, 1.2 1.3 and accordingly, the next item in col "a" as number 2 and
accordingly the item 4 and 5 in col "b" as 2.1 & 2.2 and so on.....

Tom Ogilvy

Sequential number within excel
 
Number them where?

Using a Macro?

--
Regards,
Tom Ogilvy


"Dev" wrote:

Please see the data below

a b c
000000080672 EI0G18 1.00
EIVH38 1.00
EIVK38 1.00
000000082585 EIRH69 1.00
EIRK69 1.00

the first 3 items in column B belongs to the first item in column a.
Accordingly the next 2 items in col "b" belongs to the next item in col "A".
I want to number the first item in col "A" as 1 and the 3 items in col "B" as
1.1, 1.2 1.3 and accordingly, the next item in col "a" as number 2 and
accordingly the item 4 and 5 in col "b" as 2.1 & 2.2 and so on.....


dev

Sequential number within excel
 
Is there a way to number them in col "D".

"Dev" wrote:

Please see the data below

a b c
000000080672 EI0G18 1.00
EIVH38 1.00
EIVK38 1.00
000000082585 EIRH69 1.00
EIRK69 1.00

the first 3 items in column B belongs to the first item in column a.
Accordingly the next 2 items in col "b" belongs to the next item in col "A".
I want to number the first item in col "A" as 1 and the 3 items in col "B" as
1.1, 1.2 1.3 and accordingly, the next item in col "a" as number 2 and
accordingly the item 4 and 5 in col "b" as 2.1 & 2.2 and so on.....


Tom Ogilvy

Sequential number within excel
 
Sub number_items()
Dim imajor As Long, iminor As Long
Dim rng As Range, cell As Range
imajor = 0
iminor = 0
Set rng = Range(Cells(1, "B"), _
Cells(Rows.Count, "B").End(xlUp))
For Each cell In rng
If Not IsEmpty(cell.Offset(0, -1)) Then
imajor = imajor + 1
iminor = 1
End If
cell.Offset(0, 2).Value = "'" & imajor _
& "." & iminor
iminor = iminor + 1
Next
End Sub

Test this on a copy of your data. I assume the 1.0 are in column C. and
column a has some blank cells in it (your labels in the post are a little
off).

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote:

Number them where?

Using a Macro?

--
Regards,
Tom Ogilvy


"Dev" wrote:

Please see the data below

a b c
000000080672 EI0G18 1.00
EIVH38 1.00
EIVK38 1.00
000000082585 EIRH69 1.00
EIRK69 1.00

the first 3 items in column B belongs to the first item in column a.
Accordingly the next 2 items in col "b" belongs to the next item in col "A".
I want to number the first item in col "A" as 1 and the 3 items in col "B" as
1.1, 1.2 1.3 and accordingly, the next item in col "a" as number 2 and
accordingly the item 4 and 5 in col "b" as 2.1 & 2.2 and so on.....


MartinK[_2_]

Sequential number within excel
 
Using Formulas it Would look something like this:
Columns D
=IF(ROW()=2;1;IF(A2<"";D1+1;D1))
Column E
= IF(ROW()=2;1;E1+1)
Column F
= D2&"."&E2



All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com