Covert a table/array to single column, skipping blank cells

ehesh

New Member
Joined
Jun 26, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I have a big array of data with 195 columns and 7825 rows. I am trying to convert the array to a single column skipping blank cells.

I found the following formula and have been trying to tweak it with COUNTA(MyData) but so far am struggling to get a positive result

=INDEX(MyData,1+INT((ROW(A1)-1)/COLUMNS(MyData)),MOD(ROW(A1)-1+COLUMNS(MyData),COLUMNS(MyData))+1).
 

Attachments

  • Captura de pantalla 2022-06-28 114855.png
    Captura de pantalla 2022-06-28 114855.png
    31 KB · Views: 95

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
How about
Excel Formula:
=LET(a,A2:A7&"",b,B2:F7&"",c,COLUMNS(b),r,c*ROWS(a),s,SEQUENCE(r,,0),x,INDEX(a,INT(s/c)+1),y,INDEX(b,INT(s/c)+1,MOD(s,c)+1),FILTER(CHOOSE({1,2},x,y),MMULT((SEQUENCE(r)>=SEQUENCE(,r))*(INDEX(x,,1)=TRANSPOSE(INDEX(x,,1)))*(y=""),SEQUENCE(r,,,0))<=1))
 
Upvote 0
How about
Excel Formula:
=LET(a,A2:A7&"",b,B2:F7&"",c,COLUMNS(b),r,c*ROWS(a),s,SEQUENCE(r,,0),x,INDEX(a,INT(s/c)+1),y,INDEX(b,INT(s/c)+1,MOD(s,c)+1),FILTER(CHOOSE({1,2},x,y),MMULT((SEQUENCE(r)>=SEQUENCE(,r))*(INDEX(x,,1)=TRANSPOSE(INDEX(x,,1)))*(y=""),SEQUENCE(r,,,0))<=1))
it works for the short table I had on the picture but when using it on the actual data I get a an error. Is there any modifications I need to make on the formula?
 
Upvote 0
it works for the short table I had on the picture but when using it on the actual data I get a an error. Is there any modifications I need to make on the formula?
I think I got it to work on a smaller range from what I was attempting range but it actually runs out of resource calculating.
 
Upvote 0
You might need to rethink what you are doing. 195*7825 = 1,369,375 rows. You have a row limit of 1,048,576.
You would need to have over 300,000 blank cells but perhaps that limit even applies to when it is doing the calculations.
 
Upvote 0
Hadn't paid much attention to the size of data & sequence is limited to 1,048,576 rows so it will not work on that amount of data.
I don't know if power query can do something like this, but that might be a better option if it can do it.
 
Upvote 0
I have no idea how this would go with large data either and it requires the TOCOL function which not all 365 subscribers have yet (it is being rolled out gradually)

22 06 29.xlsm
ABCDEFGHIJ
1
2Class1JohnMarySueStephanClass1John
3Class2ClarkCeliaClass1Mary
4Class3EmilyTaylorTimothyClass1Sue
5Class4JuneJeffClass1Stephan
6Class5MikeCliffMayPeterJacobClass2Clark
7Class6NathanSylviaClass2Celia
8Class3Emily
9Class3Taylor
10Class3Timothy
11Class4June
12Class4Jeff
13Class5Mike
14Class5Cliff
15Class5May
16Class5Peter
17Class5Jacob
18Class6Nathan
19Class6Sylvia
TOCOL
Cell Formulas
RangeFormula
I2:I19I2=TOCOL(IF(B2:F7="",NA(),A2:A7),3)
J2:J19J2=TOCOL(B2:F7,1)
Dynamic array formulas.
 
Upvote 0
Power Query should have no trouble doing the conversion.
See 2min video below. Its pretty much.
  • Load from range
  • Select ALL
  • Transform Unpivot Columns
  • Close and Load data bac to Excel
You would still need to work out what you are going to do with the data.
If you blow the excel row limit you would either need to return a summarised data set or load it to the Data Model and use it as the basis for your reporting.

 
Upvote 0
Solution
I have no idea how this would go with large data either
Well, I just tried with 200 columns and 7,000 rows with some blank cells scatted throughout. Initially it failed but I think that I must have still had more results than would fit in a column.
Deleted some values and now, still with 7,000 rows and 200 columns but some columns blank, the formulas have produced about 1,045,000 result rows and the recalculation time for the left hand column is about 0.5 seconds and the right column about 0.1 seconds so not too bad!
 
Upvote 0
You might need to rethink what you are doing. 195*7825 = 1,369,375 rows. You have a row limit of 1,048,576.
You would need to have over 300,000 blank cells but perhaps that limit even applies to when it is doing the calculations.
Yeah, there are indeed a lot of blank cells. I COUNTA the range and confirmed I have 41726 actual items to use, so the total rows would be 41726
 
Upvote 0

Forum statistics

Threads
1,225,132
Messages
6,183,041
Members
453,146
Latest member
scarabeovini

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