ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   customised output (https://www.excelbanter.com/excel-discussion-misc-queries/51749-customised-output.html)

TUNGANA KURMA RAJU

customised output
 
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

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


All times are GMT +1. The time now is 04:26 PM.

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