Ask Your Question
0

How do I highlight duplicate values?

asked 2018-03-01 15:44:32 +0200

Astralogic gravatar image

Hi, can I make a selection (in Calc) and then highlight all duplicates values in the cells?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2018-03-03 01:14:28 +0200

m.a.riosv gravatar image

Or with a conditional format.

MarkDuplicateValues.ods

image description

edit flag offensive delete link more
0

answered 2018-03-02 13:59:02 +0200

Gilward Kukel gravatar image

updated 2018-03-03 17:00:05 +0200

Example:

  • A1: a
  • A2: 3
  • A3: 1
  • A4: 2
  • A5: 3
  • A6: 1
  • A7: 1
  1. Go to A1.
  2. Menu Data > Pivot Table > Create...
  3. OK.
  4. Drag "a" from Available Fields to Row Fields.
  5. Drag "a" from Available Fields to Data Fields. It becomes "Sum - a".
  6. Double-click "Sum - a".
  7. Click on Count. OK.
  8. OK. A Pivot table is created in a new sheet. It looks like this:
a Count - a
1 3
2 1
3 2
Total Result  6

Now you can see how often the values occur. To update the pivot table right click on it and choose Refresh.


Different solution:

This Python3 program counts values:

#! python3
import csv
d=dict()
with open('input.txt', newline='') as csvfile:
     reader = csv.reader(csvfile, delimiter='\t')
     for row in reader:
         for x in row:
            if x=='':
                continue
            if x not in d:
                d[x]=1
            else:
                d[x]=d[x]+1

a=list(d.keys())
a.sort()

with open('output.txt', 'w', newline='') as csvfile2:
    writer = csv.writer(csvfile2, delimiter='\t')
    for k in a:
        s=[k,d[k]]
        writer.writerow(s)
edit flag offensive delete link more

Comments

Thank you, that's exactly what I needed. Is there a way to include more columns then just one?

Astralogic gravatar imageAstralogic ( 2018-03-03 13:15:25 +0200 )edit

no :(


Gilward Kukel gravatar imageGilward Kukel ( 2018-03-03 16:18:35 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-03-01 15:44:32 +0200

Seen: 9,513 times

Last updated: Mar 03 '18