How to ID and split out 2 records that share the same email address?

This should be simple, but once again my brain runs out of RAM and crashes.

I have a data set that is a list of names and email addresses. Some of the names have the same email addresses. I want to be able to look through the whole list of names, and identify and extract those names that have the same email address.

The result should be the name and the email address that match.

Hey @Robm,

Depending on your input data maybe the quickest option would be to use an If node to check if the email field is empty. The quick example below shows this approach.

Example Workflow

Thanks Jon,

In my data set there would an email address present for every person. I need to look and see if any 2 or 3 or 4 (or number) of people have the same email address.

I have modified you example data set to illustrate. In this example I would after the result

Tony [email protected]
Bruce [email protected]

Ah my brain stopped working when reading what you put, For some reason I thought you were just after empty records.

Try this one…

Get Duplicates

when testing your flow

ERROR: All returned items have to contain a property named “json”! [Line 104]


here is a sample of the json that I am working with

"Paddler 1 Name": "Robin",
"Paddler 1 Email": "[email protected]",
"Paddler 1 Name": "Batman",
"Paddler 1 Email": "[email protected]",
"Paddler 1 Name": "Alfred",
"Paddler 1 Email": "[email protected]",

Hrmmm… this is an odd one!
This should technically work… but doesn’t seem to want to work in n8n!

Hey @Robm,

This example works, Not sure why the first didn’t.


Sorry Jon, I am getting the same error with you most recent example. If we can solve the error I think your function will do the job.

Hey @Robm,

Are you changing the example worklfow at all? When you get the error which node is throwing it? I am not sure if something else is missing in the input data maybe.

OK, thanks to @Jon I’ve figured it out!

This should work @Robm


I took your function, and dropped it into the real workflow, ie not using sample data, and it has worked perfectly!

Thanks so much!

1 Like

That is good to hear, I wonder what was up with the examples :smile:

I have a final request and you can tell me to get lost!

I am looking to learn more about functions. Could you give me a tour for dummies of the logic of the function?