Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi,
Am Wed, 12 Mar 2014 07:54:39 +0000 schrieb CS Chia: I have a table that list items and the frequency for each item, as shown below Item frequency A 1 B 3 C 4 D 1 E 0 Base on the above, the system should populate a list base on the above Expected result is: Item Count A 1 B 1 B 2 B 3 C 1 C 2 C 3 C 4 D 1 your table in sheet1. The following macro writes the expected table in sheet2: Sub ArrangeTable() Dim arrIn As Variant Dim LRow As Long Dim i As Long, j As Long, n As Long LRow = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row arrIn = Range("A2:B" & LRow) n = 1 With Sheets("Sheet2") For i = LBound(arrIn) To UBound(arrIn) If arrIn(i, 2) 0 Then For j = 1 To arrIn(i, 2) .Cells(n, 1) = arrIn(i, 1) .Cells(n, 2) = j n = n + 1 Next End If Next End With End Sub Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I count items based upon two separate values? | Excel Worksheet Functions | |||
2 conditions needed to check and count of items based on that | Excel Worksheet Functions | |||
How to count and group items in a list depending on size of list? | Excel Programming | |||
How to count items in a list and group depending on size of list? | Excel Programming | |||
Count items on the list | Excel Discussion (Misc queries) |