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?
Microsoft OfficeMicrosoft Access

Avatar of undefined
Last Comment

8/22/2022 - Mon

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?
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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
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


Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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.