Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Selecting data from columns and displaying them as rows

This may be any easy thing to do but I'm trying to do the following and I
need a very detailed explanation of how to do it. About 1000 employees will
be grouped but their subordinate will need to
be displayed on the same row as the employee with each subordinate in a
different column for each employee.

I trying to convert this type of table:
EMPLOYEE SUBORDINATE
Employee 1 Subordinate A
Employee 1 Subordinate B
Employee 2 Subordinate C
Employee 2 Subordinate D
Employee 3 Subordinate E
Employee 3 Subordinate F

To this type:
EMPLOYEE SUBORDINATE 1 SUBORDINATE 2
Employee 1 Subordinate A Subordinate B
Employee 2 Subordinate C Subordinate D
Employee 3 Subordinate E Subordinate F


Thank you,

Chris

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Selecting data from columns and displaying them as rows

What you are asking for requires a macro. Something like this should be
close...

Public Sub TransposeSpecial()
Dim rngEmp As Range
Dim rngAllEmps As Range
Dim wks As Worksheet
Dim wksNew As Worksheet
Dim rngPaste As Range

Set wks = ActiveSheet
Set wksNew = Worksheets.Add
Set rngPaste = wksNew.Range("A1")

With wks
Set rngAllEmps = .Range(.Range("A2"), .Cells(Rows.Count, "A").End(xlUp))
End With

For Each rngEmp In rngAllEmps
If rngEmp.Value < rngEmp.Offset(-1, 0).Value Then
Set rngPaste = rngPaste.Offset(1, 0)
rngPaste.Value = rngEmp.Value
End If
rngPaste.Offset(0, _
Application.WorksheetFunction.CountA(rngPaste.Enti reRow)).Value
= _
rngEmp.Offset(0, 1)
Next rngEmp
End Sub
--
HTH...

Jim Thomlinson


"chrisvail" wrote:

This may be any easy thing to do but I'm trying to do the following and I
need a very detailed explanation of how to do it. About 1000 employees will
be grouped but their subordinate will need to
be displayed on the same row as the employee with each subordinate in a
different column for each employee.

I trying to convert this type of table:
EMPLOYEE SUBORDINATE
Employee 1 Subordinate A
Employee 1 Subordinate B
Employee 2 Subordinate C
Employee 2 Subordinate D
Employee 3 Subordinate E
Employee 3 Subordinate F

To this type:
EMPLOYEE SUBORDINATE 1 SUBORDINATE 2
Employee 1 Subordinate A Subordinate B
Employee 2 Subordinate C Subordinate D
Employee 3 Subordinate E Subordinate F


Thank you,

Chris

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Selecting data from columns and displaying them as rows

Hi Jim,

Thank you! This worked perfectly. Very useful.

Chris

"Jim Thomlinson" wrote:

What you are asking for requires a macro. Something like this should be
close...

Public Sub TransposeSpecial()
Dim rngEmp As Range
Dim rngAllEmps As Range
Dim wks As Worksheet
Dim wksNew As Worksheet
Dim rngPaste As Range

Set wks = ActiveSheet
Set wksNew = Worksheets.Add
Set rngPaste = wksNew.Range("A1")

With wks
Set rngAllEmps = .Range(.Range("A2"), .Cells(Rows.Count, "A").End(xlUp))
End With

For Each rngEmp In rngAllEmps
If rngEmp.Value < rngEmp.Offset(-1, 0).Value Then
Set rngPaste = rngPaste.Offset(1, 0)
rngPaste.Value = rngEmp.Value
End If
rngPaste.Offset(0, _
Application.WorksheetFunction.CountA(rngPaste.Enti reRow)).Value
= _
rngEmp.Offset(0, 1)
Next rngEmp
End Sub
--
HTH...

Jim Thomlinson


"chrisvail" wrote:

This may be any easy thing to do but I'm trying to do the following and I
need a very detailed explanation of how to do it. About 1000 employees will
be grouped but their subordinate will need to
be displayed on the same row as the employee with each subordinate in a
different column for each employee.

I trying to convert this type of table:
EMPLOYEE SUBORDINATE
Employee 1 Subordinate A
Employee 1 Subordinate B
Employee 2 Subordinate C
Employee 2 Subordinate D
Employee 3 Subordinate E
Employee 3 Subordinate F

To this type:
EMPLOYEE SUBORDINATE 1 SUBORDINATE 2
Employee 1 Subordinate A Subordinate B
Employee 2 Subordinate C Subordinate D
Employee 3 Subordinate E Subordinate F


Thank you,

Chris

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
Selecting vertical rows and displaying them horizontally. chrisvail Excel Discussion (Misc queries) 2 October 6th 09 11:48 PM
selecting data from a combination of columns & rows. Browny Excel Discussion (Misc queries) 5 July 30th 09 09:47 AM
selecting non consectutive cells/rows/columns in excel 2007 PammyBB Excel Discussion (Misc queries) 3 March 26th 09 04:34 PM
Selecting All Rows with Certain Data Ron Coderre Excel Discussion (Misc queries) 0 November 29th 06 07:44 PM
Selecting All Rows with Certain Data DCrabill Excel Discussion (Misc queries) 0 November 29th 06 07:20 PM


All times are GMT +1. The time now is 08:50 PM.

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

About Us

"It's about Microsoft Excel"