#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Pivot Table ?

I have a list of Employees and the year they started as follows:

Employee Year
John 1998
Betty 2001
Sam 1985
Joe 1998
Pete 2001

I would like to create a list like this:

1985 1998 2001
Sam John Betty
Joe Pete

I tried to use a Pivot Table, but I cant get the names in each column.

Any suggestions would be appreciated.

Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Pivot Table ?

Pivottables show numeric summaries--sums, counts, averages...

They can't show text in the details.

But you could use a macro:

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet
Dim iRow As Long
Dim res As Variant
Dim DestCell As Range

Set CurWks = Worksheets("sheet1")
Set NewWks = Worksheets.Add

With CurWks
.Range("b1", .Cells(.Rows.Count, "b").End(xlUp)).AdvancedFilter _
Action:=xlFilterCopy, _
copytorange:=NewWks.Range("a1"), _
unique:=True
End With

With NewWks
With .Range("A1", .Cells(.Rows.Count, "A").End(xlUp))
.Sort key1:=.Columns(1), order1:=xlAscending, _
header:=xlYes
.Copy
.Range("b1").PasteSpecial Transpose:=True
.Columns(1).Delete
End With
End With

With CurWks

For iRow = 2 To .Cells(.Rows.Count, "A").End(xlUp).Row
res = Application.Match(.Cells(iRow, "b").Value, _
NewWks.Rows(1), 0)
If IsError(res) Then
'this shouldn't happen!
MsgBox "Error with row #: " & iRow
Else
With NewWks
Set DestCell _
= .Cells(.Rows.Count, res).End(xlUp).Offset(1, 0)
End With
DestCell.Value = .Cells(iRow, "A").Value
End If
Next iRow
End With
End Sub

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Big John wrote:

I have a list of Employees and the year they started as follows:

Employee Year
John 1998
Betty 2001
Sam 1985
Joe 1998
Pete 2001

I would like to create a list like this:

1985 1998 2001
Sam John Betty
Joe Pete

I tried to use a Pivot Table, but I cant get the names in each column.

Any suggestions would be appreciated.

Thanks in advance.


--

Dave Peterson
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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Copying values from pivot table to cells outside pivot table richzip Excel Discussion (Misc queries) 4 January 16th 08 11:03 PM
Filter lines with Pivot table and non Pivot table columns Grover Excel Discussion (Misc queries) 1 September 26th 07 12:48 AM
Filter lines containing pivot table and non pivot table data Grover Excel Worksheet Functions 0 September 24th 07 07:20 PM
How do I create a pivot table if the pivot table icon or menu ite. Lynn@WS Charts and Charting in Excel 1 December 16th 04 02:36 AM


All times are GMT +1. The time now is 12:07 AM.

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"