How can I AUTOMATE combining two lists in Numbers (Columns A & B) and delete the duplicates. No manual process PLEASE!

I keep getting lists that I need to merge with previously merged lists. The new list most likely has duplicate names of what I already have but MIGHT have new names. I want an AUTOMATED way to combine the lists and delete the duplicates. Note that the names on the new lists MIGHT have spaces at the end of the cell so that needs to be taken into account too. If they spell the name wrong or add middle initials, that is someone else's problem.


Does Apple have some say to automate what I'm asking above IF I put the two lists into table next to each other (Columns A & B) like with Automator or something.


Note: I USED to be a programmer but memory issues have taken that way and I'm struggling to figure out how to use Automator for this which is humiliating compared to what I used to be able to do. Getting diabetes and getting old SUCKS!


[Re-Titled by Moderator]

Original Title: How can I AUTOMATE combining two lists in Numbers (Columns A & B) and delete the duplicates. No manual process PLEASE!


Also, please no Filters NOR Pivot tables because I have to do other things with the data and that would make it significantly harder for me. Thanks.

iMac 27″

Posted on Jan 4, 2026 5:00 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 5, 2026 2:47 PM

Since you posted this in the Numbers forum, I'm assuming you want a Numbers-based solution.


If your existing data is in Column A and you paste/import the new data into Column B, then this formula in C1 will give you a new column of data containing unique, distinct values:


=UNIQUE(TOCOL(A:B,1,TRUE),FALSE,FALSE)


It uses two functions - first TOCOL() combines all the values in columns A and B into one list. This list is then run through UNIQUE() to filter out duplicates.


The resulting list will be similar to Column A, with any new values in Column B appended at the end.


4 replies
Question marked as Top-ranking reply

Jan 5, 2026 2:47 PM in response to OlsonBW

Since you posted this in the Numbers forum, I'm assuming you want a Numbers-based solution.


If your existing data is in Column A and you paste/import the new data into Column B, then this formula in C1 will give you a new column of data containing unique, distinct values:


=UNIQUE(TOCOL(A:B,1,TRUE),FALSE,FALSE)


It uses two functions - first TOCOL() combines all the values in columns A and B into one list. This list is then run through UNIQUE() to filter out duplicates.


The resulting list will be similar to Column A, with any new values in Column B appended at the end.


Jan 6, 2026 10:40 AM in response to OlsonBW

> Yes on wanting this in numbers but how else would you do it with software "built-in" to the Mac?


That's a highly leading question :)


A lot depends on the nature of the source data (single column? CSV? Spreadsheet? plain text?), your skills, and what third party apps you may have.


If you're skilled in the command line, then there are a myriad of command-line solutions.


If the files are just a list of names and you want to combine them:


cat a.txt b.txt | sort -u


this works by taking the contents of the files a.txt and b.txt and piping them into sort, where the -u switch tells it to output only unique values.

It's a little more complex if the files are tabular or comma-delimited, since you need to parse out the relevant field, but still doable. All the classic UNIX commands are available, including grep, sed, awk, and the ease (or otherwise ;) ) of these tools will depend on the complexity of the files and your shell scripting abilities.


Moving up the stack a little, reading, parsing, and writing files isn't that hard with AppleScript. Again, the difficulty will depend on the complexity of the file and how well you know AppleScript.

Personally, I'm a big fan of AppleScript. Here's an example script that combines unique lines from two files (it's probably not the most efficient, and may choke on very large files, but it shows the idea):


try
	-- prompt the user for two files
	set fileList to choose file with prompt "Select  TWO text files to merge:" with multiple selections allowed
	-- bail if two files weren't provided
	if (count of fileList) is not 2 then error "Please select exactly two files."
	
	-- extract the two files
	set file1 to item 1 of fileList
	set file2 to item 2 of fileList
	
	-- read their contents into lists based on paragraphs
	-- this will need more work if the files are comma-delimited
	set file1Contents to paragraphs of (read file1 as «class utf8»)
	set file2Contents to paragraphs of (read file2 as «class utf8»)
	
	set mergedLists to MyMergeLists(file1Contents, file2Contents)
	
	-- convert the lists to a single text stream
	set outText to my MyJoinList(mergedLists, linefeed)
	
	-- define the path for the output file
	set outPath to ((file1 as text) & "_merged.txt") as text
	
	-- write out the combined list
	set fileRef to open for access file outPath with write permission
	set eof of fileRef to 0
	write outText to fileRef as «class utf8»
	close access fileRef
	
	-- and let the user know we're done
	display dialog "Merge Complete" & return & "Output file: " & outPath buttons {"OK"} default button 1
	
on error errMsg number errNum
	display dialog "Error " & errNum & return & errMsg buttons {"OK"} default button 1
end try


-- ====== HANDLERS ======

on MyMergeLists(initialList, appendList)
    -- this works by starting with the first list, and appending the items in the second list
	set outputList to initialList
	repeat with thisItem in appendList
		set t to thisItem as text
		if (t is not "") and (t is not in outputList) then
			set end of outputList to t
		end if
	end repeat
	return outputList
end MyMergeLists


on MyJoinList(theList, delimiter)
	set {oldtid, my text item delimiters} to {my text item delimiters, delimiter}
	set outText to theList as text
	set my text item delimiters to oldtid
	return outText
end MyJoinList


(note that it's also possible to embed shell scripts within AppleScript, so I might just incorporate the shell commands above to to the heavy lifting :) )


If you're open to third party apps, there are a number of text-focussed apps that can do this out of the box. The venerable BBEdit even has a one-click option to process duplicate lines, and also supports regular expressions for more complex matches (e.g. delimited files, padded fields, etc.)

How can I AUTOMATE combining two lists in Numbers (Columns A & B) and delete the duplicates. No manual process PLEASE!

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