Id like to use a filter and sort formula to filter out and sort all numbers that have two or more of the same number. they are all 4 digit numbers.
0055
0121
1134
2352
3411
this is just an example list of the output I would need. Thank you
CodePudding user response:
Replace numList
with the range you're sorting on. (Or use numList
as a named range for your input set.)
=SORT(FILTER(numList,
(LEN(SUBSTITUTE(numList,LEFT(numList,1),""))<>3)
(LEN(SUBSTITUTE(numList,MID(numList,2,1),""))<>3)
(MID(numList,3,1)=RIGHT(numList,1))))
Filter conditions:
(LEN(SUBSTITUTE(numList,LEFT(numList,1),""))<>3)
Checks if the first digit is repeated.(LEN(SUBSTITUTE(numList,MID(numList,2,1),""))<>3)
Checks if the second digit is repeated.(MID(numList,3,1)=RIGHT(numList,1))
Checks if digits 3 and 4 are the same. We can take this shortcut because we've already checked the first two digits at this point.
If any of these is true, then we have a repeating digit.