Text cell list sorting problem

Harold123

New Member
Joined
May 16, 2016
Messages
23
I have a large set of cells with Text inside I need to sort into lists and in such a way that each list produced from the first omits one cell. The difficulty for me in particular is that the number of cells can vary. To illustrate simply below is a simplified set of cells with one word in each. Each subsequently generated list has a different omission. In this sample there are 4 Cells in the list Column Giving rise to four columns of lists, had the list been 20 cells long there would have been 20 generated.

Orig
List 1 2 3 4
---------------------------------------------
Cat Dog Mouse Bird Cat
Dog Mouse Bird Cat Dog
Mouse Bird Cat Dog Mouse
Bird

From the list on the left 4 lists are generated all with one different cell missing. To complicate matters the list can be any number of cells typically 20 but can be as high as 40 and is very time consuming.
Can anyone see a formula here or is it VBA, any suggestions help really appreciate.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Here is a formula approach. Formula in B1 is copied across (as far as you like) and down (as far as you like).

Excel Workbook
ABCDEF
1CatDogCatCatCat
2DogMouseMouseDogDog
3MouseBirdBirdBirdMouse
4Bird
5
Lists



Here expanded to a list of 10

Excel Workbook
ABCDEFGHIJKL
1Item 1Item 2Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1
2Item 2Item 3Item 3Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2
3Item 3Item 4Item 4Item 4Item 3Item 3Item 3Item 3Item 3Item 3Item 3
4Item 4Item 5Item 5Item 5Item 5Item 4Item 4Item 4Item 4Item 4Item 4
5Item 5Item 6Item 6Item 6Item 6Item 6Item 5Item 5Item 5Item 5Item 5
6Item 6Item 7Item 7Item 7Item 7Item 7Item 7Item 6Item 6Item 6Item 6
7Item 7Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 7Item 7Item 7
8Item 8Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 8Item 8
9Item 9Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 9
10Item 10
11
Lists (2)
 
Upvote 0
Marginally shorter.

Excel Workbook
ABCDEF
1CatDogCatCatCat
2DogMouseMouseDogDog
3MouseBirdBirdBirdMouse
4Bird
5
Lists (3)
 
Upvote 0
.. & if you know to copy it across the number of columns equal to the number of data rows and down the number of rows one less than the number of data rows then a fair chunk can be removed as well.

Excel Workbook
ABCDEFGHIJK
1Item 1Item 2Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1
2Item 2Item 3Item 3Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2
3Item 3Item 4Item 4Item 4Item 3Item 3Item 3Item 3Item 3Item 3Item 3
4Item 4Item 5Item 5Item 5Item 5Item 4Item 4Item 4Item 4Item 4Item 4
5Item 5Item 6Item 6Item 6Item 6Item 6Item 5Item 5Item 5Item 5Item 5
6Item 6Item 7Item 7Item 7Item 7Item 7Item 7Item 6Item 6Item 6Item 6
7Item 7Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 7Item 7Item 7
8Item 8Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 8Item 8
9Item 9Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 9
10Item 10
Lists (4)
 
Upvote 0
Wow, well i knew the likely solution was beyond my knowledge of excel, i just didnt realise it was that far.
thank you so much that was so quick and worked perfectly. Thank you.
 
Upvote 0
Wow, well i knew the likely solution was beyond my knowledge of excel, i just didnt realise it was that far.
thank you so much that was so quick and worked perfectly. Thank you.
You are very welcome. Thanks for the follow-up. :)
 
Upvote 0
Whoops I may have spoken to soon. On a short list your first formula worked perfectly.
I tried it on a list of 24 and it didnt work, So I altered it as Follows that didnt work either giving me duplicates.
Im assuming I have altered something I shouldnt have or havent altered enough.
Code:
=IF(OR(ROWS(B$1:B1)>=ROWS($A$1:$A$24),COLUMNS($B:B)>ROWS($A$1:$A$24)),"",INDEX($A$1:$A$24,AGGREGATE(15,6,ROW($A$1:$A$24)-ROW($A$1)+1,ROWS(B$1:B1)+(ROWS(B$1:B1)>=COLUMNS($B:B)))))
Its bound to be me sorry about that.
 
Last edited:
Upvote 0
So I altered it as Follows that didnt work either giving me duplicates.
Code:
=IF(OR(ROWS(B$1:B1)>=ROWS($A$1:$A$24),COLUMNS($B:B)>ROWS($A$1:$A$24)),"",INDEX($A$1:$A$24,AGGREGATE(15,6,ROW($A$1:$A$24)-ROW($A$1)+1,ROWS(B$1:B1)+(ROWS(B$1:B1)>=COLUMNS($B:B)))))
.
That modification for 24 items is exactly right by my reckoning and works for me below (at least as far as I understand the objective).

Can you be more specific about your data and exactly what "duplicates" occurred & where. Perhaps show the sample data and output as I have been doing?


Excel 2016
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1Item 1Item 2Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1Item 1
2Item 2Item 3Item 3Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2Item 2
3Item 3Item 4Item 4Item 4Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3Item 3
4Item 4Item 5Item 5Item 5Item 5Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4Item 4
5Item 5Item 6Item 6Item 6Item 6Item 6Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5Item 5
6Item 6Item 7Item 7Item 7Item 7Item 7Item 7Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6Item 6
7Item 7Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7Item 7
8Item 8Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8Item 8
9Item 9Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9Item 9
10Item 10Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10Item 10
11Item 11Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11Item 11
12Item 12Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12Item 12
13Item 13Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13Item 13
14Item 14Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14Item 14
15Item 15Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15Item 15
16Item 16Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 17Item 16Item 16Item 16Item 16Item 16Item 16Item 16Item 16
17Item 17Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 18Item 17Item 17Item 17Item 17Item 17Item 17Item 17
18Item 18Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 19Item 18Item 18Item 18Item 18Item 18Item 18
19Item 19Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 20Item 19Item 19Item 19Item 19Item 19
20Item 20Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 21Item 20Item 20Item 20Item 20
21Item 21Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 22Item 21Item 21Item 21
22Item 22Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 23Item 22Item 22
23Item 23Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 24Item 23
24Item 24
Lists (5)
Cell Formulas
RangeFormula
B1=IF(OR(ROWS(B$1:B1)>=ROWS($A$1:$A$24),COLUMNS($B:B)>ROWS($A$1:$A$24)),"",INDEX($A$1:$A$24,AGGREGATE(15,6,ROW($A$1:$A$24)-ROW($A$1)+1,ROWS(B$1:B1)+(ROWS(B$1:B1)>=COLUMNS($B:B)))))
 
Upvote 0
I am so sorry, and I did look before I replied but it was me, ( I had a mistake in my earlier formula that created the original list).
It does work perfectly I have even tesed it on larger lists now.
You have saved me such a lot of time and opened up new pastures for my Excel.
I am so sorry to have wasted yours like this.
Thnk you once again
 
Upvote 0
I am so sorry, and I did look before I replied but it was me, ( I had a mistake in my earlier formula that created the original list).
It does work perfectly I have even tesed it on larger lists now.
You have saved me such a lot of time and opened up new pastures for my Excel.
I am so sorry to have wasted yours like this.
Thnk you once again
No problem. This is what the forum is for. Glad it worked out in the end. :)
 
Upvote 0

Forum statistics

Threads
1,223,532
Messages
6,172,881
Members
452,486
Latest member
standw01

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