View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default customised output

I know that I wouldn't/couldn't do it using a formula, but a small macro could
do it.

If you want a macro:

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim oRow As Long
Dim wks As Worksheet
Dim TimesToRepeat As Long

Set wks = ActiveSheet

With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row

oRow = 1
For iRow = FirstRow To LastRow
TimesToRepeat = .Cells(iRow, "B").Value
If TimesToRepeat 0 Then
.Cells(oRow, "C").Resize(TimesToRepeat).Value _
= .Cells(iRow, "A").Value
oRow = oRow + TimesToRepeat
End If
Next iRow
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Be aware that there is not a speck of validation in this routine. If you put
non-numeric values in column B, it'll blow up real good.

TUNGANA KURMA RAJU wrote:

col a col b col c
john 2 john
mary 3 john
cathy 0 mary
jones 4 mary
mary
jones
jones
jones
jones
col a and col b is my input.Is there any formula to get out put like col c.I
fave a big list of col a and col b.Please give me idea.


--

Dave Peterson