Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 151
Default Transposing data with Index function

Hi,

I've been using this function to transpose records from a single column (A)
to several columns:
=INDEX($A:$A,(ROWS($1:1)-1)*6+COLUMNS($A:B)-1)

All the records were 5 lines with one blank separating each record. The new
file I've received has records that range from 4 lines to 6 lines with a
blank separating each one. How do I work with records of differing sizes?
Do I need a macro now?

Libby
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Transposing data with Index function

You need one heck of a function, or code. I don't know the specifics of your
project, but you can try this:


Sub CombineRows()

LastRow = Range("A" & Rows.Count).End(xlUp).Row
'set rowcount to row where you want 1st entry
RowCount = 1
NewRow = RowCount
Start = False
Do While RowCount <= LastRow
If Start = False Then
If Range("A" & RowCount) < "" Then
Start = True
StartRow = RowCount
End If

Else
If Range("A" & (RowCount + 1)) = "" Then
ColCount = 1
For MoveRow = StartRow To RowCount
Cells(NewRow, ColCount) = Cells(MoveRow, "A")
ColCount = ColCount + 1
Next MoveRow
NewRow = NewRow + 1
Start = False
End If
End If
RowCount = RowCount + 1
Loop

Rows(NewRow & ":" & LastRow).Delete

End Sub

NOTICE!! MAKE A BACKUP AND RUN THE CODE ON YOUR BACKUP, IN CASE IT DOESN'T
DO WHAT YOU WANT IT TO DO!!

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Libby" wrote:

Hi,

I've been using this function to transpose records from a single column (A)
to several columns:
=INDEX($A:$A,(ROWS($1:1)-1)*6+COLUMNS($A:B)-1)

All the records were 5 lines with one blank separating each record. The new
file I've received has records that range from 4 lines to 6 lines with a
blank separating each one. How do I work with records of differing sizes?
Do I need a macro now?

Libby

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 151
Default Transposing data with Index function

Well, ryguy7272, that macro is one big bag of SWEET!!!

You will live in my heart forever :)

Libby

"ryguy7272" wrote:

You need one heck of a function, or code. I don't know the specifics of your
project, but you can try this:


Sub CombineRows()

LastRow = Range("A" & Rows.Count).End(xlUp).Row
'set rowcount to row where you want 1st entry
RowCount = 1
NewRow = RowCount
Start = False
Do While RowCount <= LastRow
If Start = False Then
If Range("A" & RowCount) < "" Then
Start = True
StartRow = RowCount
End If

Else
If Range("A" & (RowCount + 1)) = "" Then
ColCount = 1
For MoveRow = StartRow To RowCount
Cells(NewRow, ColCount) = Cells(MoveRow, "A")
ColCount = ColCount + 1
Next MoveRow
NewRow = NewRow + 1
Start = False
End If
End If
RowCount = RowCount + 1
Loop

Rows(NewRow & ":" & LastRow).Delete

End Sub

NOTICE!! MAKE A BACKUP AND RUN THE CODE ON YOUR BACKUP, IN CASE IT DOESN'T
DO WHAT YOU WANT IT TO DO!!

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Libby" wrote:

Hi,

I've been using this function to transpose records from a single column (A)
to several columns:
=INDEX($A:$A,(ROWS($1:1)-1)*6+COLUMNS($A:B)-1)

All the records were 5 lines with one blank separating each record. The new
file I've received has records that range from 4 lines to 6 lines with a
blank separating each one. How do I work with records of differing sizes?
Do I need a macro now?

Libby

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Transposing data with Index function

Lucky guess, I guess. Go ahead and click 'Yes' if the solution helped.

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Libby" wrote:

Well, ryguy7272, that macro is one big bag of SWEET!!!

You will live in my heart forever :)

Libby

"ryguy7272" wrote:

You need one heck of a function, or code. I don't know the specifics of your
project, but you can try this:


Sub CombineRows()

LastRow = Range("A" & Rows.Count).End(xlUp).Row
'set rowcount to row where you want 1st entry
RowCount = 1
NewRow = RowCount
Start = False
Do While RowCount <= LastRow
If Start = False Then
If Range("A" & RowCount) < "" Then
Start = True
StartRow = RowCount
End If

Else
If Range("A" & (RowCount + 1)) = "" Then
ColCount = 1
For MoveRow = StartRow To RowCount
Cells(NewRow, ColCount) = Cells(MoveRow, "A")
ColCount = ColCount + 1
Next MoveRow
NewRow = NewRow + 1
Start = False
End If
End If
RowCount = RowCount + 1
Loop

Rows(NewRow & ":" & LastRow).Delete

End Sub

NOTICE!! MAKE A BACKUP AND RUN THE CODE ON YOUR BACKUP, IN CASE IT DOESN'T
DO WHAT YOU WANT IT TO DO!!

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Libby" wrote:

Hi,

I've been using this function to transpose records from a single column (A)
to several columns:
=INDEX($A:$A,(ROWS($1:1)-1)*6+COLUMNS($A:B)-1)

All the records were 5 lines with one blank separating each record. The new
file I've received has records that range from 4 lines to 6 lines with a
blank separating each one. How do I work with records of differing sizes?
Do I need a macro now?

Libby

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding rows to the data array used in an Index function Lanhing Excel Discussion (Misc queries) 1 April 7th 09 07:45 PM
trying to use the index function when #N/A can be part of data ran Dan T. Excel Worksheet Functions 5 August 2nd 08 06:27 AM
Index Function acceptig data from another sheet Gulfman100 New Users to Excel 1 April 15th 08 09:50 AM
how do i automate an index function with a data table Gracie_J Excel Worksheet Functions 0 October 8th 06 11:32 PM
Transposing Data using Offset function sarah Excel Worksheet Functions 2 March 31st 06 01:39 AM


All times are GMT +1. The time now is 09:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"