Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If is possible with a mcro... my problem, i have this sheet with many value into column A (all value are already oredered) is possible to insert into column L the count numebr of value repeated from a equal range block? Example: into line 3 and 4 is present the same value 4500450961 well inert into column L the numer 2 into L3, blank the other line refered line 4 into line 11, 12 and 13 is present the same value 4500451080 well inert into column L the numer 3 into L11, blank the other line refered line 12 and 13 if the value into acolumn A is present only one insert into column L the value "0" Tks. +-------------------------------------------------------------------+ |Filename: ADD_NUMBER.zip | |Download: http://www.excelforum.com/attachment.php?postid=3786 | +-------------------------------------------------------------------+ -- sal21 ------------------------------------------------------------------------ sal21's Profile: http://www.excelforum.com/member.php...fo&userid=2040 View this thread: http://www.excelforum.com/showthread...hreadid=465484 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is a bit ugly and assumes your data starts in row 2 i.e headings in
first row: Sub huh() Dim eRow As Long Dim ColA As Range Dim cell As Range Dim cNtr As Long Dim cRow As Long Dim val As Variant '<change to suit data in column A eRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 Set ColA = Range(Cells(3, 1), Cells(eRow, 1)) val = Cells(2, 1).Value cRow = 2 cNtr = 1 For Each cell In ColA If cell.Value = val Then cNtr = cNtr + 1 Else If cNtr = 1 Then Cells(cRow, 12).Value = 0 Else Cells(cRow, 12).Value = cNtr End If cRow = cell.Row cNtr = 1 val = cell.Value End If Next cell End Sub Hope this helps Rowan sal21 wrote: If is possible with a mcro... my problem, i have this sheet with many value into column A (all value are already oredered) is possible to insert into column L the count numebr of value repeated from a equal range block? Example: into line 3 and 4 is present the same value 4500450961 well inert into column L the numer 2 into L3, blank the other line refered line 4 into line 11, 12 and 13 is present the same value 4500451080 well inert into column L the numer 3 into L11, blank the other line refered line 12 and 13 if the value into acolumn A is present only one insert into column L the value "0" Tks. +-------------------------------------------------------------------+ |Filename: ADD_NUMBER.zip | |Download: http://www.excelforum.com/attachment.php?postid=3786 | +-------------------------------------------------------------------+ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Rowan Wrote: This is a bit ugly and assumes your data starts in row 2 i.e headings in first row: Sub huh() Dim eRow As Long Dim ColA As Range Dim cell As Range Dim cNtr As Long Dim cRow As Long Dim val As Variant '<change to suit data in column A eRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 Set ColA = Range(Cells(3, 1), Cells(eRow, 1)) val = Cells(2, 1).Value cRow = 2 cNtr = 1 For Each cell In ColA If cell.Value = val Then cNtr = cNtr + 1 Else If cNtr = 1 Then Cells(cRow, 12).Value = 0 Else Cells(cRow, 12).Value = cNtr End If cRow = cell.Row cNtr = 1 val = cell.Value End If Next cell End Sub Hope this helps Rowan sal21 wrote: If is possible with a mcro... my problem, i have this sheet with many value into column A (all value are already oredered) is possible to insert into column L the count numebr of value repeated from a equal range block? Example: into line 3 and 4 is present the same value 4500450961 well inert into column L the numer 2 into L3, blank the other line refered line 4 into line 11, 12 and 13 is present the same value 4500451080 well inert into column L the numer 3 into L11, blank the other line refered line 12 and 13 if the value into acolumn A is present only one insert into column L the value "0" Tks. +-------------------------------------------------------------------+ |Filename: ADD_NUMBER.zip | |Download: http://www.excelforum.com/attachment.php?postid=3786 | +-------------------------------------------------------------------+ Work fine! -- sal21 ------------------------------------------------------------------------ sal21's Profile: http://www.excelforum.com/member.php...fo&userid=2040 View this thread: http://www.excelforum.com/showthread...hreadid=465484 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide column(x) by column(y) to give column(x/y) in excel? | New Users to Excel | |||
Referencing date column A & time column B to get info from column | Excel Discussion (Misc queries) | |||
Return text in Column A if Column B and Column K match | Excel Worksheet Functions | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Discussion (Misc queries) | |||
Divide Column A by Column B multiply Column C | Excel Worksheet Functions |