How can I find duplicates in Numbers?

How can I find duplicates in Numbers?

Do I search each field or is there a short cut?

iMac (21.5-inch Mid 2011), OS X Mountain Lion (10.8.4)

Posted on Jul 19, 2013 9:47 AM

Reply
66 replies

Mar 18, 2014 2:06 PM in response to k8ty68

Here it is in a Get Missing Values Automator Service. (Dropbox dowload)


Usage is as described above: select the cells, run it by making a pick from the Services menu, paste the values wherever you want.


If you want to change the range from 1-100 to something else you can open the workflow in Automator and change the numbers after rangeStart and rangeEnd at the top of the script. To open it in Automator you can hold down the option key in Finder and in the menu Go > Library > Services, then doubleclick the .workflow package. If you need to delete it from your Services menu just send the .workflow package to the trash the way you would any other Finder item.


BTW, making an Automator Service from an AppleScript is quick and easy. Just open Automator, File > New, choose 'Service' as the type of document, drag a Run AppleScript action from the left into the right pane (to find that action just type 'apple' into the search box), and paste the script into the action, in this case replacing all the default code that Automator suggests. Choose 'No Input' after 'Service receives' and choose 'Numbers.app' after 'in' and save. It should then automatically show up in yur Services menu.


SG

Mar 26, 2014 11:36 AM in response to SGIII

Is there an Applescript I can use to remove duplicates in the following way -- a purge. Here is the scenario...


In row B is a list of active URLS. In the next row, Row C, is a list of URLS that became inactive.


How can I pass the list of Inactive URLS in Row C against the good URLS in Row B and do the following -- If an entry in the In-active URLS matches an entry in the ACTIVE URLS, delete that entry from the Actives.


In other words, I need to purge the Active URLS of any that may be inactive.


What script could I use to accomplish this?


Thank you so much.


writer_in_virginia

Mar 26, 2014 11:49 AM in response to writer_in_virginia

There is a script you can try posted by SG earlier in this same thread. Review that and see if it helps you. You can use the navigation arrows and numbers at the top and bottom of this thread to go to other pages in this thread:


User uploaded file


Of if the script does not do what you want you can do something like this:

User uploaded file


Add a new column after the list is inactive URLS (in this example, column D).


D2=IF(COUNTIF($C, B2)>0, "", B2)


this is shorthand for select cell D2, then type (or copy and paste from here) the formula:

=IF(COUNTIF($C, B2)>0, "", B2)


select cell D2, copy

select column D, paste


now column D ONLY contains valid URLs. You can copy it, then select column B, then select the menu item "Edit > Paste Formula Results", now empty the inactive URL list and repeat later as needed

Mar 26, 2014 12:40 PM in response to writer_in_virginia

No such thing as a super-dumb question with spreadsheets. They can be complicated. I think Wayne will answer on your formula entry problem.


Meanwhile, here is a script you can paste into AppleScript Editor and run. It puts the results on the clipboard so you can paste the new list where you want it via command-v or Edit > Paste and Match Style. It assumes you have clicked somewhere on the table. You can change the numbers in the "Properties" if you decide to put your lists in columns other than B and C.


SG



-- active list in one column, inactive list in another

-- produces a new list with inactive values removed

-- run and paste results where needed

property colNumActive : 2 -- change if Active List in column other than B

property colNumInactive : 3 -- change if Inactive List in column other than C

property firstBodyRow : 2 -- change if other than 1 header row


set activeList to getNonBlankColValues(colNumActive)

set inactiveList to getNonBlankColValues(colNumInactive)


--loop through activeList removing any matches with inactiveList

set newList to {}

repeat with i from 1 to count of activeList

tell item i of activeList

if it is not in inactiveList then copy it to end of newList

end tell

end repeat

set the clipboard tojoinList(newList, return)

display notification "Cleaned list ready to paste."


to getNonBlankColValues(colNum)

try

tell application "Numbers" to tell front document to tell active sheet to tell (first table whose class of selection range is range) to tell column colNum

set colVals to {}

repeat with i from firstBodyRow to count cells

tell cell i

if value is not missing value then copy value to end of colVals

end tell

end repeat

return colVals

end tell

on error

display dialog "Having trouble. Did you select a table that has values in columns B and C?" buttons "Cancel" default button "Cancel"

return

end try

end getNonBlankColValues


to joinList(aList, separator)

set {oTID, AppleScript'stext item delimiters} to {AppleScript'stext item delimiters, separator}

set listStr to aList as string

set AppleScript'stext item delimiters to oTID

return listStr

end joinList


-- end of script

Mar 26, 2014 12:55 PM in response to writer_in_virginia

ENTERS A FORMULA IN A SINGLE CELL:

D2=IF(COUNTIF($C, B2)>0, "", B2)


<<Pay particular attention here>>

this is shorthand for select cell D2, then type (or copy and paste from here) the formula:

=IF(COUNTIF($C, B2)>0, "", B2)


NOW DUPLICATE THE FORMULA IN THE WHOLE COLUMN

select cell D2, copy

select column D, paste


FINALLY, REPLACE THE ORIGNAL LIST WITH ONLY ACTIVE URLS:

now column D ONLY contains valid URLs. You can copy it, then select column B, then select the menu item "Edit > Paste Formula Results", now empty the inactive URL list and repeat later as needed

Mar 26, 2014 2:51 PM in response to Wayne Contello

When I start by entering the formula =IF(COUNTIF($C, B2)>0, "", B2) in cell D2, it then says (after clicking on the green check mark), "This formula contains a syntax error."


Am trying to follow your instructions to the letter, so I don't know where I got it wrong.


I understand your instruction:

NOW DUPLICATE THE FORMULA IN THE WHOLE COLUMN

select cell D2, copy

select column D, paste


It's just the first step before that which I'm not getting right.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I find duplicates in Numbers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.