Search code examples
excelexcel-formula

Excel Highlight cells where numbers in a cell contains same digit twice or more


I have a excel list with 4 digit combinations about 10000 combination numbers like:

Here sample list:

0001
0002
....
1234
....
9998
9999

I need to highlight numbers where we have number which containts 2 same digits or 3 same digits like in 0001 we have number 0 repeated 3 times or in 9999 we have number 9 repeated 4 times in the number

Is there way to do this (any formula) in excel to hightlight numbers like this?


Solution

  • Not sure if there is a simpler method - but this works for Excel 365:

    =LET(dSplit,MID(A1,SEQUENCE(1,4),1), 
         dOffset,MID(A1,SEQUENCE(1,4,2),1),
         OR(dSplit=dOffset))
    

    enter image description here