• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

combine two tables in single column without blank cells

jb

Member
I have two sample tables table-1 and table-2 on sheet1 (sample file attached).

Table-1 a4 to c6 and table2 a10 to c12.

I want to combine two tables in single column and blank cells are to be removed in output.

I have 4 solutions for creating seperate list for table-1 and table-2.

3 solutions are on sheet1 which uses formula and 4th solution is on sheet2 which uses VBA coding.

I prefer 4th or 3rd solution. But now I am not able to create single list for both the tables. Rather I want single list to be created directly without creating seperate list.
 

Attachments

  • test_table.xlsm
    17.9 KB · Views: 10
Perhaps a small tweak of your formula in K4
=IFERROR(INDIRECT("Sheet1!"&TEXT(SMALL(IF((Sheet1!$A$4:$C$12<>"")*(LEFT(Sheet1!$A$4:$C$12,5)<>"Table") ,ROW(Sheet1!$A$4:$C$12)*10^4+COLUMN(Sheet1!$A$4:$C$12)),ROWS($A$4:A4)),"R0000C0000"),0),"")
 

Attachments

  • Copy of test_table.xlsm
    19.5 KB · Views: 14
  • Like
Reactions: jb
Maybe,

Solution-4 : combine your Solution-3 two formulas into one :

=IFERROR(INDIRECT(TEXT(IF(ROWS($1:1)<=COUNTA(A$4:C$6),SMALL(IF(A$4:C$6<>"",ROW($4:$6)/1%%+{1,2,3}),ROWS($1:1)),SMALL(IF(A$10:C$12<>"",ROW($10:$12)/1%%+{1,2,3}),ROWS($1:1)-COUNTA(A$4:C$6))),"R0000C0000"),0),"")

Regards
Bosco
 
Last edited:
Perhaps a small tweak of your formula in K4
=IFERROR(INDIRECT("Sheet1!"&TEXT(SMALL(IF((Sheet1!$A$4:$C$12<>"")*(LEFT(Sheet1!$A$4:$C$12,5)<>"Table") ,ROW(Sheet1!$A$4:$C$12)*10^4+COLUMN(Sheet1!$A$4:$C$12)),ROWS($A$4:A4)),"R0000C0000"),0),"")


Thanks a lot. Worked perfectly.
 
Maybe,

Solution-4 : combine your Solution-3 two formulas into one :

=IFERROR(INDIRECT(TEXT(IF(ROWS($1:1)<=COUNTA(A$4:C$6),SMALL(IF(A$4:C$6<>"",ROW($4:$6)/1%%+{1,2,3}),ROWS($1:1)),SMALL(IF(A$10:C$12<>"",ROW($10:$12)/1%%+{1,2,3}),ROWS($1:1)-COUNTA(A$4:C$6))),"R0000C0000"),0),"")

Regards
Bosco


Thanks a lot. It worked perfectly.
 
It highly depends on the software policy applied in the company if installing such a plugin is allowed. Also if others are using the solution, thy need to installed the plugin as well. Not always advisable.
In case of home use those constraints are likely to be non-existing.
Personally I would go for a Power Query solution to avoid both the volatile/array and the plugin solution.

Some steps could be nested, but I prefer using separate steps.
upload_2018-7-26_9-18-21.png
Code:
let
  Source = Excel.Workbook(File.Contents("G:\Uploads\Copy of test_table.xlsm"), null, true),
  Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
  #"Changed Type" = Table.TransformColumnTypes(Sheet1_Sheet,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
  FilterOutNullAndTable = Table.SelectRows(#"Changed Type", each [Column1] <> null and not Text.StartsWith([Column1], "Table")),
  GroupAllinTable = Table.Group(FilterOutNullAndTable, {}, {{"All", each _, type table}}),
  MakeLists = Table.AddColumn(GroupAllinTable, "List", each Table.ToList([All])),
  ExpandList = Table.ExpandListColumn(MakeLists, "List"),
  SplitListAsList = Table.AddColumn(ExpandList, "ListSplit", each Text.Split([List], ",")),
  ExpandListSplitInRows = Table.ExpandListColumn(SplitListAsList, "ListSplit"),
  KeepListSplit = Table.SelectColumns(ExpandListSplitInRows,{"ListSplit"}),
  FilterOutBlanks = Table.SelectRows(KeepListSplit, each ([ListSplit] <> ""))
in
  FilterOutBlanks
 

Attachments

  • Copy of test_table.xlsm
    17.2 KB · Views: 2
Alphabet,I did something simplistic, without volatile, but with array
{=IFERROR(MID("abcdefghijklmnopqrstuvwxyz",AGGREGATE(15,6,1/(1/SMALL(IFERROR(SEARCH($A$4:$C$12,"abcdefghijklmnopqrstuvwxyz")*(LEN($A$4:$C$12)=1),0),ROW($A$1:$A$30))),ROW(A1)),1),"")}

David
 
Back
Top