Display Only Common Lines Across Two Cells in a Row

grimley2

New Member
Joined
Feb 1, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
A​
B​
C​
Apple Pie
Banana
Pear
Orange
Tangerine
Apple Pie
Apricot
Pear
Plum Jam
Apple Pie
Pear

Hello, I'm looking for a formula to generate cell C in this example, displaying the common lines across cells A & B.
The data is delimited with line breaks, but is comprised of multiple lines within individual cells, not down a column.
Thank you!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Please try this formula in cell C1:
=TEXTJOIN(CHAR(10),TRUE,FILTER(TEXTSPLIT(SUBSTITUTE(A1,CHAR(10),","),","),IFERROR(TEXTSPLIT(SUBSTITUTE(A1,CHAR(10),","),",",,TRUE)=TEXTSPLIT(SUBSTITUTE(B1,CHAR(10),","),",",,TRUE),FALSE),""))
 
Upvote 0
This was suggested to me on Reddit, I'm wondering if it's also possible to display the output as a vertical list like the input(s):
=TEXTJOIN(CHAR(10),1,IF(ISNUMBER(MATCH(TEXTSPLIT(A1,,CHAR(10)),TEXTSPLIT(B1,,CHAR(10)),0)),TEXTSPLIT(A1,,CHAR(10)),""))
 
Upvote 0
This was suggested to me on Reddit,

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

If you have posted the question on any other site please supply a link to those site(s)

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Glad it's sorted & thanks for letting us know.
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top