How to combine rows based on duplicate numbers and combine text

New Contributor
I'm working with notification records and have thousands of cases with case number in one collumn multiple notification notices in another. Is there a way to merge rows with the same case number and preserve the text? Formatting doesn't particularly matter for how the text is merged as long as it's still there and reduces it to one row per case number. Thanks!
2 Replies
1 | this
1 | that
2 | and
3 | the
3 | other
I want to merge based on collumn A and combine collumn B so it's
1 | this that
2 | and
3 | the other

@Sam-L Consider the following screenshot:



Create a list of unique numbers. This can be done in various ways, for example with a pivot table. If you want an approach for that aspect, please pipe up.


Then you can use a TextJoin function, which is a new function in Excel 2019 and Excel 365. It is not available in earlier versions.


=TEXTJOIN(" ",TRUE,IF($A$1:$A$5=D1,$B$1:$B$5,""))


This is an array formula and must be confirmed with Ctrl + Shift + Enter (unless your Excel version already has the new dynamic array functions enabled).