Link to home
Get AccessLog in
Avatar of Pau Lo
Pau Lo

asked on

merge all cells from all columns into a single list.

is there an easy way in access, to merge all data in all fields into a single list? I have received some data and it looks like 95% of the cells in most columns are empty, but I need an automatic way to merge all data from all columns which are not blank into a single list of data/column of data. Any suggestions if this can be done? there are over 60'000 rows of data, the first column is full of entries, but then there are dozens of fields and 95%  of them seem to be blank, so merging all cells in the table from all fields, where the cell is not blank would be a great help. Is there also a limit on the number of fields you can import into access?
Avatar of Norie

What do you mean by 'cells'?

An Access table doesn't have 'cells' it consists of records with fields.

Do you mean that you have multiple records where the majority of fields are empty?

Are there any fields that are have a value for all records?
Avatar of Pau Lo


records within fields then.
Do you mean that you have multiple records where the majority of fields are empty?
Are there any fields that are have a value for all records?
o 60k rows yes there are less than 10 rows where theres a value in every field in that record.
Are you trying to 'merge' multiple fields into a single field through concatenation or are you trying to 'normalize' the table data into multiple rows?

A representative before and after data sample would be helpful
Avatar of Pau Lo


No not through concatenation as such, just appending all valid entries to the end of the entries (non blanks) in field A, for every column. so if there were 60k rows in column A (no blanks), then50 non blanks in field B, and 20 non blanks in field C etc etc, then the result would be all the non blanks from A, B, C in one list, with 60'070 entries. The problem is I have over 220 'fields'.

A very quick before and after would be:
field A-Field B-Field C

would show as

Avatar of aikimark
Flag of United States of America image

Link to home
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
I think Excel has a convert columns to rows option that might do this.  The issue would be, do you end up with too many rows for your version of Excel to handle?  This will only take a little automation code and then you can link to the  updated sheet or import the data.

As aikimark mentioned, you are going to get a "too complex" error for a union well before you get to 220 columns.  I would use a VBA loop that iterates through the columns of the linked spreadsheet and builds and runs an append query for each separate column selecting only non-null (and possibly non-ZLS - which are different) values.