Excel/Access Cross Tab

dstogner

New Member
Joined
Jun 27, 2011
Messages
8
I have data listed in 2 columns. Column # 1 contains an account number and the same number can appear multiple times. In column 2 contains an inventory #. So it appears as follows:

Acct Number Item Number
123456 S4567
123456 G8954
456789 F8965
456789 L4565
456789 W678
456789 J8965

What I need is to convert the information so that the account number show up once and the item numbers are then in rows next to the account number as follows:

Acct Number Item #1 Item #2 Item #3 Item #4
123456 S4567 G8954
456789 F8954 L4565 W678 J8965

Any suggestions would be GREATLY appreciated. I have tried in excel and the cross tab wizard in access and can't seem to get the correct result.

THANK YOU!!!!!!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Here is an Access solution:

If you add an Item Counter field, you can do this, i.e.
Code:
Acct Number   Item Counter   Item Number
123456               1            S4567
123456               2            G8954
456789               1            F8965
456789               2            L4565
456789               3            W678
456789               4            J8965
Then, you can use a Cross-Tab Query, choosing Acct Number as your Row Headers, Item Counter as your Column Headers, and First of Item Number as the body.

The SQL code would look something like this (assuming the name of the table is "MyTable"):
Code:
TRANSFORM First(MyTable.[Item Number]) AS [FirstOfItem Number]
SELECT MyTable.[Acct Number]
FROM MyTable
GROUP BY MyTable.[Acct Number]
PIVOT MyTable.[Item Counter];
Note, you can create the Item Number column pretty easily, either in Excel or using DAO/ADO recordset looping in Access VBA.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top