Hi
Thanks for the help.
I had (set countchecklist to {}) in the wrong place to get the results I wanted.
Basically what I was doing was checking which of the 6 number list got the most 3 number matches of the 3 number lists.
Will have to remember not to use the same variable twice.
The numbers are unique.
Heres how it turned out. Both versions give the same result.
--tell application "Microsoft Excel"
--launch
--other script got these lists
set testList3combos15 to {{3, 9, 11}, {3, 12, 13}, {7, 8, 9}, {3, 6, 11}, {6, 7, 11}, {2, 3, 12}, {3, 6, 8}, {3, 5, 7}, {2, 11, 13}, {8, 9, 13}, {2, 9, 11}, {7, 10, 13}, {2, 6, 12}, {3, 6, 10}, {1, 2, 7}, {1, 3, 6}, {1, 9, 13}, {1, 2, 13}, {2, 4, 6}, {1, 6, 9}, {12, 13, 14}, {4, 7, 14}, {2, 12, 14}, {3, 4, 8}, {3, 10, 14}, {6, 8, 14}, {3, 12, 15}, {7, 8, 10}, {2, 4, 11}, {1, 13, 14}, {3, 4, 15}, {3, 4, 10}, {2, 12, 15}, {1, 7, 10}, {10, 13, 15}, {2, 4, 15}, {1, 4, 9}, {1, 13, 15}, {5, 9, 15}, {4, 8, 14}, {8, 11, 15}, {1, 12, 14}, {1, 8, 14}, {5, 8, 14}, {4, 10, 14}, {4, 10, 11}, {1, 14, 15}, {1, 8, 10}, {1, 10, 15}}
set checkList to {{6, 10, 4, 1, 11, 8}, {9, 3, 7, 4, 12, 13}, {14, 11, 4, 12, 10, 13}, {2, 7, 6, 9, 1, 5}, {7, 8, 2, 11, 15, 1}, {12, 3, 11, 1, 13, 15}, {15, 4, 10, 8, 5, 12}, {8, 13, 1, 12, 9, 3}, {7, 3, 6, 11, 8, 5}, {15, 2, 1, 13, 11, 9}}
set HighCountList to {}
repeat with i from 1 to (count checkList)
set countchecklist to {}
repeat with j from 1 to (count testList3combos15)
set counttest to 0
if list j of testList3combos15 contains (item 1 of list i of checkList) then set counttest to counttest + 1
if list j of testList3combos15 contains (item 2 of list i of checkList) then set counttest to counttest + 1
if list j of testList3combos15 contains (item 3 of list i of checkList) then set counttest to counttest + 1
if list j of testList3combos15 contains (item 4 of list i of checkList) then set counttest to counttest + 1
if list j of testList3combos15 contains (item 5 of list i of checkList) then set counttest to counttest + 1
if list j of testList3combos15 contains (item 6 of list i of checkList) then set counttest to counttest + 1
set end of countchecklist to counttest
end repeat
--gets 3 matches
set CountHighHits to 0
repeat with k from 1 to the count of the countchecklist
if item k of countchecklist is 3 then set CountHighHits to CountHighHits + 1
end repeat
set end of HighCountList to CountHighHits
end repeat
--get highest number of 3 hits
set the highHit to ""
repeat with i from 1 to the count of the HighCountList
set thisItem to item i of the HighCountList
if the highHit is "" then
set the highHit to thisItem
else if thisItem is greater than the highHit then
set the highHit to item i of the HighCountList
end if
end repeat
--finds 1st highest match in list
set the listCount to 0
repeat with i from 1 to the count of the HighCountList
set thisItem to item i of the HighCountList
if thisItem is less than highHit then set listCount to listCount + 1
if thisItem is highHit then exit repeat
end repeat
set MostMatches to list (listCount + 1) of checkList
return MostMatches
--end tell
--launch
--other script got these lists
-- I surmise that all lists of checklist contains 3 unique numbers, and that testList3combos15 does the same.
set testList3combos15 to {{3, 9, 11}, {3, 12, 13}, {7, 8, 9}, {3, 6, 11}, {6, 7, 11}, {2, 3, 12}, {3, 6, 8}, {3, 5, 7}, {2, 11, 13}, {8, 9, 13}, {2, 9, 11}, {7, 10, 13}, {2, 6, 12}, {3, 6, 10}, {1, 2, 7}, {1, 3, 6}, {1, 9, 13}, {1, 2, 13}, {2, 4, 6}, {1, 6, 9}, {12, 13, 14}, {4, 7, 14}, {2, 12, 14}, {3, 4, 8}, {3, 10, 14}, {6, 8, 14}, {3, 12, 15}, {7, 8, 10}, {2, 4, 11}, {1, 13, 14}, {3, 4, 15}, {3, 4, 10}, {2, 12, 15}, {1, 7, 10}, {10, 13, 15}, {2, 4, 15}, {1, 4, 9}, {1, 13, 15}, {5, 9, 15}, {4, 8, 14}, {8, 11, 15}, {1, 12, 14}, {1, 8, 14}, {5, 8, 14}, {4, 10, 14}, {4, 10, 11}, {1, 14, 15}, {1, 8, 10}, {1, 10, 15}}
set checkList to {{6, 10, 4, 1, 11, 8}, {9, 3, 7, 4, 12, 13}, {14, 11, 4, 12, 10, 13}, {2, 7, 6, 9, 1, 5}, {7, 8, 2, 11, 15, 1}, {12, 3, 11, 1, 13, 15}, {15, 4, 10, 8, 5, 12}, {8, 13, 1, 12, 9, 3}, {7, 3, 6, 11, 8, 5}, {15, 2, 1, 13, 11, 9}}
set HighCountList to {}
repeat with i from 1 to (count checkList)
set thisCheck to list i of checkList
set countchecklist to {}
repeat with j from 1 to (count testList3combos15)
set {a, b, c} to list j of testList3combos15
set counttest to 0
if a is in thisCheck then set counttest to counttest + 1
if b is in thisCheck then set counttest to counttest + 1
if c is in thisCheck then set counttest to counttest + 1
set end of countchecklist to counttest
end repeat
--gets 3 matches
set CountHighHits to 0
repeat with k from 1 to the count of the countchecklist
if item k of countchecklist is 3 then set CountHighHits to CountHighHits + 1
end repeat
set end of HighCountList to CountHighHits
end repeat
--gets the highest amount of 3 matches
set the highHit to ""
repeat with i from 1 to the count of the HighCountList
set thisItem to item i of the HighCountList
if the highHit is "" then
set the highHit to thisItem
else if thisItem is greater than the highHit then
set the highHit to item i of the HighCountList
end if
end repeat
--finds 1st highest match in list
set the listCount to 0
repeat with i from 1 to the count of the HighCountList
set thisItem to item i of the HighCountList
if thisItem is less than highHit then set listCount to listCount + 1
if thisItem is highHit then exit repeat
end repeat
set MostMatches to list (listCount + 1) of checkList
return MostMatches
Thanks again
bills