Selecting rows from a table without getting duplicate cells

Jeff46A

New Member
Joined
Dec 2, 2008
Messages
5
I don't know if this is an Excel problem, or if it belongs somewhere else. If it shouldn't be here please excuse me and I'll drop it.

The table contains rows of five numbers. The aim is to select as many rows as possible without duplicating any of the numbers. The full table is larger than this one, but I hope there's enough data to illustrate the question.

4,5,206,219,273
7,13,52,267,271
8,24,96,117,193
9,16,29,51,282
10,16,48,114,230
11,22,117,275,282
11,68,88,95,214
12,26,113,175,220
12,36,113,127,216
13,18,124,263,264
13,21,124,204,268
13,35,102,142,219
17,39,76,181,201
17,43,52,158,251
18,19,60,68,198
19,30,104,155,164
19,31,104,155,164
19,33,128,248,252
19,57,73,249,282
20,44,101,211,252
20,49,126,146,252
20,52,80,209,273
21,45,81,166,220
21,61,82,200,247
22,34,72,124,244
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Point out in your shortened example where the 1st and second Duplicate occurs and what should be done if and when it happens.
 
Upvote 0
In the Mean-time - here's a shot at what maybe you want...: Cell I3 Formula =
=COUNTIF($C$3:$G$27,C3)>1

Copy over and down...

<tbody>
</tbody>

Excel 2010
ABCDEFGHIJKLM
1** YOUR DATA ***** Convert Your Data Text to Columns ****** Enter Countif Formula - True = Duplicate ***
2*** Then Apply Conditional Format - Value = True***
34,5,206,219,27345206219273FALSEFALSEFALSETRUETRUE
47,13,52,267,27171352267271FALSETRUETRUEFALSEFALSE
58,24,96,117,19382496117193FALSEFALSEFALSETRUEFALSE
69,16,29,51,2829162951282FALSETRUEFALSEFALSETRUE
710,16,48,114,230101648114230FALSETRUEFALSEFALSEFALSE
811,22,117,275,2821122117275282TRUETRUETRUEFALSETRUE
911,68,88,95,21411688895214TRUETRUEFALSEFALSEFALSE
1012,26,113,175,2201226113175220TRUEFALSETRUEFALSETRUE
1112,36,113,127,2161236113127216TRUEFALSETRUEFALSEFALSE
1213,18,124,263,2641318124263264TRUETRUETRUEFALSEFALSE
1313,21,124,204,2681321124204268TRUETRUETRUEFALSEFALSE
1413,35,102,142,2191335102142219TRUEFALSEFALSEFALSETRUE
1517,39,76,181,201173976181201TRUEFALSEFALSEFALSEFALSE
1617,43,52,158,251174352158251TRUEFALSETRUEFALSEFALSE
1718,19,60,68,19818196068198TRUETRUEFALSETRUEFALSE
1819,30,104,155,1641930104155164TRUEFALSETRUETRUETRUE
1919,31,104,155,1641931104155164TRUEFALSETRUETRUETRUE
2019,33,128,248,2521933128248252TRUEFALSEFALSEFALSETRUE
2119,57,73,249,282195773249282TRUEFALSEFALSEFALSETRUE
2220,44,101,211,2522044101211252TRUEFALSEFALSEFALSETRUE
2320,49,126,146,2522049126146252TRUEFALSEFALSEFALSETRUE
2420,52,80,209,273205280209273TRUETRUEFALSEFALSETRUE
2521,45,81,166,220214581166220TRUEFALSEFALSEFALSETRUE
2621,61,82,200,247216182200247TRUEFALSEFALSEFALSEFALSE
2722,34,72,124,244223472124244TRUEFALSEFALSETRUEFALSE

<tbody>
</tbody>
Sheet1
 
Last edited:
Upvote 0
Thanks. What I did before I posted here was to look for the first row with a duplicate value. Number 16 appears in both the fourth and fifth rows, so I selected row 4. Going down the rows manually I selected 1-4, 7-8, 13, 16, 20 and 24-25 (your 3-7, 9-10, 15, 18, 22 and 26-27) and that gave me 11 rows and 55 unique values. I wonder if there is a way to get 12 rows or more, but I thought of the travelling salesman problem. There may be 2^25 combinations for the number of rows, or 2^125 for the number of values, but either way it isn't possible to do it be brute force.
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,391
Members
449,080
Latest member
Armadillos

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