Home

Rearranging data in Access

%3CLINGO-SUB%20id%3D%22lingo-sub-877846%22%20slang%3D%22en-US%22%3ERearranging%20data%20in%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-877846%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20input%20a%20large%20amount%20of%20data%20into%20Access%2C%20but%20instead%20of%20having%20one%20row%20for%20each%20result%2C%20the%20results%20are%20in%20a%202-dimensional%20grid%2C%20where%20each%20row%20represents%20a%20device%20being%20tested%2C%20each%20column%20represents%20a%20specific%20test%2C%20and%20a%20row-column%20combination%20results%20in%20the%20value%20from%20the%20test.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20in%20Access%20to%20shift%20all%20of%20the%20%22values%22%20data%20into%20the%20same%20column%20and%20then%20just%20identify%20each%20entry%20by%20its%20test%20ID%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-877846%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-880794%22%20slang%3D%22en-US%22%3ERe%3A%20Rearranging%20data%20in%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-880794%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406098%22%20target%3D%22_blank%22%3E%40jamesson_kaupanger%3C%2FA%3E%26nbsp%3BI%20can't%20say%20that%20its%20crystal%20clear%20what%20you%20are%20after%20but%20I%20think%20you%20are%20out%20for%20transposing%20%22rows%22%20to%20%22columns%22..%3C%2FP%3E%3CP%3EJust%20load%20the%20data%20in%20a%20recordset...iterate%20the%20fields%20on%20each%20record%20and%20.AddNew%2F.Edit%20accordingly.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-995451%22%20slang%3D%22en-US%22%3ERe%3A%20Rearranging%20data%20in%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-995451%22%20slang%3D%22en-US%22%3E%3CP%3EI%20don't%20know%20how%20I%20missed%20this%20reply...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESort%20of%3A%20I%20want%20to%20go%20from%20column%3CSTRONG%3Es%3C%2FSTRONG%3E%20to%20column.%20In%20other%20words%3A%20if%20I%20have%204%20sites%20and%20I'm%20running%205%20tests%20on%20each%20of%20those%20sites%2C%20that's%2020%20total%20test%20results.%20Currently%2C%20the%20data%20is%20laid%20out%20in%20a%204%20x%205%20grid.%20I%20want%20to%20transpose%20that%20to%20a%2020%20x%201%20grid%2C%20making%20the%20results%20all%20in%20one%20column.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1000509%22%20slang%3D%22en-US%22%3ERe%3A%20Rearranging%20data%20in%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1000509%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406098%22%20target%3D%22_blank%22%3E%40jamesson_kaupanger%3C%2FA%3E%26nbsp%3BAs%20i%20said...load%20the%20data%20on%20a%20recordset...iterate%20it%20and%20use%20it%20to%20populate%20a%20table%20with%20the%20shape%20you%20want.%3C%2FP%3E%3CP%3EProbably%20some%20sample%20data%20will%20make%20things%20clearer%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1003071%22%20slang%3D%22en-US%22%3ERe%3A%20Rearranging%20data%20in%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1003071%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F401564%22%20target%3D%22_blank%22%3E%40tsgiannis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'll%20experiment%20with%20that%20and%20get%20back%20to%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20a%20related%20note%2C%20I've%20since%20learned%20that%20Excel's%20%22Unpivot%22%20function%20is%20precisely%20what%20I'm%20trying%20to%20do.%20The%20problem%20is%20that%20it%20relies%20on%20the%20user%20creating%20a%20Query.%20I%20need%20this%20tool%20to%20be%20able%20to%20be%20used%20by%20people%20that%20do%20not%20have%20an%20intimate%20understand%20of%20Excel's%20inner%20workings.%20When%20I%20tried%20to%20implement%20the%20function%20through%20VBA%2C%20the%20result%20was%20very%20convoluted%20and%20dependent%20on%20the%20specific%20data%20there%3B%20I%20don't%20know%20how%20to%20create%20a%20generic%20query%20for%20whatever%20tests%20might%20be%20across%20the%20top%20of%20this%20file.%20Do%20you%20have%20any%20insight%20in%20that%20realm%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1003301%22%20slang%3D%22en-US%22%3ERe%3A%20Rearranging%20data%20in%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1003301%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F401564%22%20target%3D%22_blank%22%3E%40tsgiannis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20a%20simplified%20example%20of%20what%20the%20data%20looks%20like%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEach%20Excel%20file%20represents%20one%20lot%3C%2FP%3E%3CP%3EEach%20lot%20has%20several%20samples%3C%2FP%3E%3CP%3EEach%20sample%20has%20~30%20sites%20being%20tested%3C%2FP%3E%3CP%3EEach%20site%20is%20tested%20with%20up%20to%20300%20tests.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1006356%22%20slang%3D%22en-US%22%3ERe%3A%20Rearranging%20data%20in%20Access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1006356%22%20slang%3D%22en-US%22%3E%3CP%3EBased%20on%20your%20sample%20you%20need%20some%20work%20(%20i%20assume%20that%20every%20Excel%20has%20similar%20structure)%3C%2FP%3E%3CP%3EParse%20the%20Excel%20with%20Automation%26nbsp%3B%3C%2FP%3E%3CP%3ERead%20the%20Lots%20(column)%20...Group%20by%20...these%20are%20inserted%20to%20the%20LOT%20table%3C%2FP%3E%3CP%3ERead%20the%20Sites(Column)........these%20as%20inserted%20to%20the%20Sites%20table%3C%2FP%3E%3CP%3ERead%20the%20Test%20Columns........these%20as%20inserted%20to%20the%20Test%20table%3C%2FP%3E%3CP%3ERead%20the%20Columns%20with%20the%20data%20these%20are%20inserted%20to%20the%20DataValue%20table%3C%2FP%3E%3CP%3ELotID%26nbsp%3B%20SiteID%20TestID%20DataValue%3C%2FP%3E%3CP%3EI%20reckon%20that%20this%20probably%20could%20be%20a%20paid%20job%3C%2FP%3E%3C%2FLINGO-BODY%3E
jamesson_kaupanger
Contributor

I'm trying to input a large amount of data into Access, but instead of having one row for each result, the results are in a 2-dimensional grid, where each row represents a device being tested, each column represents a specific test, and a row-column combination results in the value from the test.

 

Is there a way in Access to shift all of the "values" data into the same column and then just identify each entry by its test ID?

6 Replies

@jamesson_kaupanger I can't say that its crystal clear what you are after but I think you are out for transposing "rows" to "columns"..

Just load the data in a recordset...iterate the fields on each record and .AddNew/.Edit accordingly.

I don't know how I missed this reply...

 

Sort of: I want to go from columns to column. In other words: if I have 4 sites and I'm running 5 tests on each of those sites, that's 20 total test results. Currently, the data is laid out in a 4 x 5 grid. I want to transpose that to a 20 x 1 grid, making the results all in one column.

@jamesson_kaupanger As i said...load the data on a recordset...iterate it and use it to populate a table with the shape you want.

Probably some sample data will make things clearer

@tsgiannis 

 

I'll experiment with that and get back to you.

 

On a related note, I've since learned that Excel's "Unpivot" function is precisely what I'm trying to do. The problem is that it relies on the user creating a Query. I need this tool to be able to be used by people that do not have an intimate understand of Excel's inner workings. When I tried to implement the function through VBA, the result was very convoluted and dependent on the specific data there; I don't know how to create a generic query for whatever tests might be across the top of this file. Do you have any insight in that realm?

@tsgiannis 

 

Here's a simplified example of what the data looks like:

 

Each Excel file represents one lot

Each lot has several samples

Each sample has ~30 sites being tested

Each site is tested with up to 300 tests.

Based on your sample you need some work ( i assume that every Excel has similar structure)

Parse the Excel with Automation 

Read the Lots (column) ...Group by ...these are inserted to the LOT table

Read the Sites(Column)........these as inserted to the Sites table

Read the Test Columns........these as inserted to the Test table

Read the Columns with the data these are inserted to the DataValue table

LotID  SiteID TestID DataValue

I reckon that this probably could be a paid job

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies