Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pivot Table Creation Help
 
Posts: n/a
Default create pivot table from excel table

I have a table of quarterly shipments by vendor/product and want to convert
this to a pivot table. Right now I have 12 quaters of data, with includes 8
quaters of actual data and 4 of estimates. If I get how pivot tables work, I
would need to add 12 rows for each vendor-product combination and have one
column that includes "data." Is there an automated way to convert an excel
table, where data is in multiple columns, into a pivot table? And then update
each quarter.

Please tell me if I am going about this the wrong way. I have only used,
never set up, pivot tables,

Ellen
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernie Deitrick
 
Posts: n/a
Default create pivot table from excel table

Ellen,

Select one cell in your cross-tab data table, and run the macro below. It will create a new sheet
with a database table suitable for use with pivot tables.

HTH,
Bernie
MS Excel MVP

Sub MakeTable2()
Dim myCell As Range
Dim newSheet As Worksheet
Dim mySheet As Worksheet
Dim i As Long
Dim j As Integer
Dim k As Long
Dim l As Integer
Dim mySelection As Range
Dim RowFields As Integer

Set mySheet = ActiveSheet
Set mySelection = ActiveCell.CurrentRegion
RowFields = Application.InputBox( _
"How many left-most columns to treat as row fields?", _
"CrossTab to DataBase Helper", 1, , , , , 1)
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("New Database").Delete
Application.DisplayAlerts = True
Set newSheet = Worksheets.Add
newSheet.Name = "New Database"
mySheet.Activate
i = 1
For j = mySelection(1).Row + 1 To _
mySelection(mySelection.Cells.Count).Row
For k = mySelection(1).Column + RowFields To _
mySelection(mySelection.Cells.Count).Column
If mySheet.Cells(j, k).Value < "" Then
For l = 1 To RowFields
newSheet.Cells(i, l).Value = _
Cells(j, mySelection(l).Column).Value
Next l
newSheet.Cells(i, RowFields + 1).Value = _
Cells(mySelection(1).Row, k).Value
newSheet.Cells(i, RowFields + 2).Value = _
Cells(j, k).Value
i = i + 1
End If
Next k
Next j

End Sub

"Pivot Table Creation Help" <Pivot Table Creation wrote in message
...
I have a table of quarterly shipments by vendor/product and want to convert
this to a pivot table. Right now I have 12 quaters of data, with includes 8
quaters of actual data and 4 of estimates. If I get how pivot tables work, I
would need to add 12 rows for each vendor-product combination and have one
column that includes "data." Is there an automated way to convert an excel
table, where data is in multiple columns, into a pivot table? And then update
each quarter.

Please tell me if I am going about this the wrong way. I have only used,
never set up, pivot tables,

Ellen



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
pivot table sort entries that don't yet appear in table rachael Excel Discussion (Misc queries) 11 September 19th 05 11:29 PM
Excel Pivot Table Question Tom Excel Discussion (Misc queries) 0 August 2nd 05 06:31 PM
Pivot Table Enhancements/Fixes in Excel 2003 aanyc Excel Discussion (Misc queries) 1 June 20th 05 09:23 PM
How can deleted data reappear in a refreshed pivot table in Excel excel_user123456 Excel Discussion (Misc queries) 3 February 23rd 05 08:34 PM
create space in line chart between points, linked to pivot table Mike -Z- Charts and Charting in Excel 1 December 7th 04 09:39 PM


All times are GMT +1. The time now is 11:32 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"