r/excel • • 7d ago

solved How can I arrange Textsplit data so I can remove duplicate data?

Preface: I need help with building a solution for someone who may be my future supervisor, so please excuse my stress. I really need to impress because I am a shoe-in for this position. She's not tech savvy so I'm purposefully avoiding scripts. I am very mid in Excel but willing to learn.

Raw data: 2 columns of email addresses. Some cells have more than one email address. Also includes duplicates.

Request: Put all emails in one column, remove some addresses associated with certain info, and remove duplicates.

Issue: Step one is to remove some addresses, which I do via sorting (easy). My formula for Textsplit works but it won't let me move the data because it refers to the original cells. I don't know how to arrange the data so I can remove duplicates.

1 Upvotes

34 comments sorted by

•

u/AutoModerator 7d ago

/u/vessva11 - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5

u/Miserable_Cow7578 7d ago

Since your supervisor isn't tech savvy, skip Power Query and use one simple formula that stacks everything into a single clean column automatically:

=UNIQUE(TRIM(TEXTSPLIT(TEXTJOIN(",", TRUE, A2:B100), , ",")))

That joins both columns, splits every comma-separated email vertically into one column, trims extra spaces, and removes duplicates all at once.

To fix the issue where Excel won't let you move or delete rows afterward, select that new list, press Ctrl+C, then right-click and choose Paste Values (the clipboard icon with 123). That removes the formula so you can sort or delete addresses freely.

1

u/vessva11 7d ago

Thank you! I’ll try this out. 

3

u/Academic_Airport_889 7d ago

I think using Power Query would be useful.

Duplicate the two columns of emails ( I do this because I find it useful to see the original data)

and use Power Query to split - the output will be columns without formulas.

Power Query can be used to remove duplicates as well.

1

u/vessva11 7d ago

What if a cell has 4 email addresses? I find when I textsplit, it takes each email and places it into another column and cell, which I need but it's taking too long to consolidate them into one column.

2

u/CorndoggerYYC 162 7d ago

When you use SplitByDelimeter, look under Advanced and choose Rows.

0

u/Academic_Airport_889 7d ago

Use unpivot in power query sounds like all you have are columns of email address so choose all the columns and then unpivot in power query
Once you have 1 column I would choose trim in powerquery and then remove duplicates in power query

Powerquery is pretty powerful and not too hard do to learn and the great thing is if the output isn’t as expected, you can delete steps

3

u/Post_Contrer34 6d ago

splitting directly into rows instead of columns in the advanced options there also skips having to unpivot the extra columns afterward

0

u/Academic_Airport_889 6d ago

Thanks, I didn’t realize that was an option.

I really like this Reddit so much to learn!

1

u/liamjon29 7 7d ago

This is very hard to work out a solution without visuals. Are you able to provide some sort of image/test spreadsheet that replicates the problem?

1

u/vessva11 7d ago

I edited the post. I meant email addresses, hopefully that adds context.

1

u/liamjon29 7 7d ago

I already understood it as email addresses, which is why I know you can't share actual pictures for confidentiality. But if you could make a fake image that replicates the problem, that would make it easier to find a solution. I'm not really understanding why a simple textsplit wouldn't solve your problem

1

u/vessva11 7d ago
AuthorsReaders
bob@emailjill@email
catherine@emailtoad@email
cow@emailjohn.e@mail, tommy@mail, dog@mail, friend@mail
john.e@email, egg@mailfrog@email, bob@email

1

u/Clearwings_Prime 25 7d ago

How do you "remove some addresses" with this example.

For the split part you can use

=TOCOL( TEXTAFTER(TEXTBEFORE( TOCOL(A2:B5,3),", ",SEQUENCE(,10),,1),", ",-1,,1), 3)

0

u/vessva11 7d ago

There’s certain information associated with the emails. But they aren’t that many emails, so I can sort them and remove manually. 

1

u/Clearwings_Prime 25 7d ago

Then remove those emails by hand first, then apply the formula, replace B2:B5 with your range, if you want to remove duplicate emails, add UNIQUE

=UNIQUE (TOCOL( TEXTAFTER(TEXTBEFORE( TOCOL(A2:B5,3),", ",SEQUENCE(,10),,1),", ",-1,,1), 3) )

1

u/vessva11 3d ago

Solution Verified

1

u/reputatorbot 3d ago

You have awarded 1 point to Clearwings_Prime.


I am a bot - please contact the mods with any questions

1

u/still-dazed-confused 119 7d ago

You could usefully use a helper column with the text split in which will then split your second column into many columns. You can then use vstack to stack all these new columns and the original left-hand column into one set of dates. This can then be made unique (in the same formula). You can use filter to remove any emails that match a reference column.

1

u/CorndoggerYYC 162 7d ago

Power Query solution. Paste the following code into the Advanced Editor.

let
    Source = Excel.CurrentWorkbook(){[Name="Emails"]}[Content],
    ChangedType = Table.TransformColumnTypes(Source,{{"Authors", type text}, {"Readers", type text}}),
    TableToColumns = Table.ToColumns( ChangedType),
    CombineLists = List.Combine( TableToColumns),
    ConvertToTable = Table.FromList(CombineLists, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    SplitCol = Table.ExpandListColumn(Table.TransformColumns(ConvertToTable, {{"Column1", Splitter.SplitTextByDelimiter(", ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column1"),
    ChangeType = Table.TransformColumnTypes(SplitCol,{{"Column1", type text}}),
    RemoveDups = Table.Distinct(ChangeType),
    Sort = Table.Sort(RemoveDups,{{"Column1", Order.Ascending}})
in
    Sort

1

u/matt2s 7d ago

When you say emails, do you mean email addresses? I first read it as email messages.

1

u/vessva11 7d ago

Argh, I meant email addresses. I edited the post. Sorry.

2

u/NHN_BI 808 7d ago

Excel has its own ETL tool Power Query built in. At first glance it is overwhelming, but the use is quite intuitive after that.

1

u/WesternMiserable3894 7d ago

After textsplit, remove duplicates with the UNIQUE formula. Then use SORT formula to make it easier to find near duplicates caused by typos or erroneous punctuation/spaces.

1

u/Dangerous_Cup3607 1 7d ago edited 7d ago

You know. Notepad++ can help sometimes in this regard. But a youtube tutorial on how to carve out text fields should also give you some lead on it.
But to solve it you can copy the formatted cells (col 2) and paste them into col 3 as “values” such that you can edit the cleaned up version of the emails. I do this kind of email cleaning 1% of the time for a quick clean up; but usually I just do that programmatically such as using python.

1

u/Difficult-Spirit-440 7d ago

You could keep using text split to break out each email address but use VSTACK to consolidate each column created by the split into a single column. Use Unique in front of it to remove the duplicate email addresses from the column. Trim helps by removing any unseen spaces at the beginning or end of the addresses.

=UNIQUE(VSTACK("Emails", TRIM(TEXTSPLIT(A1, , ",")), TRIM(TEXTSPLIT(B1, , ","))))

1

u/Decronym 7d ago edited 3d ago

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer LettersMore Letters
Excel.CurrentWorkbookPower Query M: Returns the tables in the current Excel Workbook.
ExtraValues.ErrorPower Query M: If the splitter function returns more columns than the table expects, an error should be raised.
List.CombinePower Query M: Merges a list of lists into single list.
QuoteStyle.CsvPower Query M: Quote characters indicate the start of a quoted string. Nested quotes are indicated by two quote characters.
SEQUENCEOffice 365+: Generates a list of sequential numbers in an array, such as 1, 2, 3, 4
SORTOffice 365+: Sorts the contents of a range or array
Splitter.SplitByNothingPower Query M: Returns a function that does no splitting, returning its argument as a single element list.
Splitter.SplitTextByDelimiterPower Query M: Returns a function that will split text according to a delimiter.
TEXTAFTEROffice 365+: Returns text that occurs after given character or string
TEXTBEFOREOffice 365+: Returns text that occurs before a given character or string
TEXTJOIN2019+: Combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value that will be combined. If the delimiter is an empty text string, this function will effectively concatenate the ranges.
TEXTSPLITOffice 365+: Splits text strings by using column and row delimiters
TOCOLOffice 365+: Returns the array in a single column
TRIMRemoves spaces from text
Table.DistinctPower Query M: Removes duplicate rows from a table, ensuring that all remaining rows are distinct.
Table.ExpandListColumnPower Query M: Given a column of lists in a table, create a copy of a row for each value in its list.
Table.FromListPower Query M: Converts a list into a table by applying the specified splitting function to each item in the list.
Table.SortPower Query M: Sorts the rows in a table using a comparisonCriteria or a default ordering if one is not specified.
Table.ToColumnsPower Query M: Returns a list of nested lists each representing a column of values in the input table.
Table.TransformColumnTypesPower Query M: Transforms the column types from a table using a type.
Table.TransformColumnsPower Query M: Transforms columns from a table using a function.
UNIQUEOffice 365+: Returns a list of unique values in a list or range
VSTACKOffice 365+: Appends arrays vertically and in sequence to return a larger array

|-------|---------|---| |||

Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.


Beep-boop, I am a helper bot. Please do not verify me as a solution.
23 acronyms in this thread; the most compressed thread commented on today has 11 acronyms.
[Thread #49749 for this sub, first seen 26th Nov 2026, 06:24] [FAQ] [Full list] ^[Contact] [Source code]

1

u/Level_Imagination544 1 7d ago

The reason it won't let you move it is because TEXTSPLIT results spill from the original formula. Once it looks right, copy the whole spilled range and use Paste Special > Values, and then you can move it and run Data > Remove Duplicates on the pasted column. If a cell has four emails, wrapping it in TOCOL() should stack everything into one column first.