Search for duplicate numbers in list?

LO 6.2.5.2, Mac OS Mojave 10.14.4

I have a long list of four-digit numbers in Writer, is there any way to get Libreoffice to highlight any duplicates of the same number (using Writer or Calc)? I don’t just mean any duplicates of a single number, I mean any numbers that occur more than once in the list.

Ideally multiples of the different numbers would be indicated/distinguished using colour/another method (rather than just all highlighted in the list), so that I can easily distinguish the different sets of multiple numbers.

For example, imagine this is my list:

1234

4321

1234

4321

Rather than all numbers simply being highlighted (as the four numbers make two pairs of the same number, and thus are multiples), I’d like for them to be distinguished somehow, such as:

(RED) 1234

(BLUE) 4321

(RED) 1234

(BLUE) 4321

Or perhaps

  1. 1234

  2. 4321

  3. 1234

  4. 4321

If you require any further information in order to answer this question please let me know.

try to play with ‘format - conditional - is duplicate’ in calc, it’s not exact your request but quite close,
if you dont mind sorting the numbers you’ll have the duplicates grouped without needing colourization,
if you need your old sorting back after handling the dups just use an additional column with an index