Forum Discussion
Create one list of names combining three lists
Hi Ian,
Try this formula starting from D1 and copy it down
=IF( ROW()<=COUNTA(A:A), INDEX(A:A,ROW()), IF(ROW()>COUNTA(A:B), IF(ROW()<= COUNTA(A:C),INDEX(C:C,ROW()-COUNTA(A:B)),"" ), INDEX(B:B,ROW()-COUNTA(A:A)) ) )
File is attached.
- Ian TobinJun 21, 2017Copper Contributor
Thank you for the reply Sergei, however I think I have tried to be too clever. I thought I would be able to change the formula to the exact specifications I was wanting but I dont seem to be able to do this. The list I need to make is on a different sheet and there are gaps between the columns on the first sheet. I have atached a workbook that looks more like what I really need.
The three columns that have data in on the first sheet need combining in a column on the second sheet if that is possible please?
Sorry for not being specific enough in the origional post.
Ian
- SergeiBaklanJun 21, 2017Diamond Contributor
Hi Ian,
Here is the solution with PowerQuery, that's Excel tool which is most suitable for such tasks. If you are on Excel 2013 is shall be downloaded and installed (fast and stright forward process), in Excel 2016 it's built-in (named as Get & Transform).
I don't know if you are familiar with it, here are step by step instructions, same is in attached file with screenshots.
1) Select all columns with source lists and name them somehow 2) Ribbon->Data click on From Table/Range 3) In appeared Query Editor remove Change Types step 4) Select (with Ctrl) columns with your names, right click on any and Remove Other Columns: 5) In Ribbon click Use First Row as Header 6) Select all columns and in Ribbon->Transform click Unpivot Columns 7) Select new column "Attributes", Right click and Remove 8) Double click on "Value" column name, enter any name you want, Enter 9) In Ribbon select Close & Load To (it's disabled for the existing query, but available for new one), after that select Table, Existing Sheet, and any place in your Sheet2
You will have in Sheet2 the table with combined list of names. If you make any changes in source data in Ribbon->Data click on Refresh All.
If you still prefer formulas let us know, will update then.
- Ian TobinJun 21, 2017Copper Contributor
Hi Sergei
I definitly prefer the formula as i dont really understand what is happening with the Query. Can you tell me what the numbers in the brackets are for on the formula you sent me on the workbook with the two sheets?
Thank you
Ian
- SergeiBaklanJun 21, 2017Diamond Contributor
Hi Ian,
Very fast modification of the formula is
=IF( ROW()<=COUNTA(Sheet1!A:A), INDEX(Sheet1!A:A,ROW()), IF(ROW()>COUNTA(Sheet1!A:D)-(4-1), IF(ROW()<= COUNTA(Sheet1!A:H)-(8-1),INDEX(Sheet1!H:H,ROW()-COUNTA(Sheet1!A:D)+4),"" ), INDEX(Sheet1!D:D,ROW()-COUNTA(Sheet1!A:A)+1) ) )
but above is very unflexible. Another approach could be using of Power Query.
I'll modify a bit some later to make the formula more human friendly, so far the result is in attached file.
- Patrick_210Feb 18, 2019Copper Contributor
Sergei I saw your script in the post above and was wondering if you could help derive a script that has been perplexing me for days now. I am trying to create teams for an upcoming function in my school district and need to set teams by two criteria a random number that has been assigned as a student ID and then make sure that a team doesn't have more than two team members from the same school. I need a script because the day of the event we will have students missing due to absence and will need to quickly rearrange the teams. I have excel 2010 and can access 2013.