Extract values from arrays of numbers

ChristineJ

Well-known Member
Joined
May 18, 2009
Messages
761
Office Version
  1. 365
Platform
  1. Windows
Are there formulas for cells B4 and B5 to achieve the desired results shown below? Thanks!

Cell B1 contains:
1, 3, 5, 6, 8, 9, 17, 19, 20, 22, 26, 28, 29, 30, 35, 37, 38, 40, 41, 45, 46, 47, 49, 50, 52, 54, 55, 56, 57, 58, 60, 64, 68, 69, 70, 71, 73, 74, 80, 81, 83, 85, 86, 89, 91, 92, 93, 95, 96, 97, 103, 104, 106, 108, 115, 116, 120, 122, 123, 125, 127, 129

Cell B2 contains:
2, 9, 18, 33, 41, 45, 61, 74, 88, 89, 92, 112

Cell B3 contains:
1, 2, 4, 6, 9, 12, 13, 16, 17, 27, 32, 41, 42, 43, 45, 47, 49, 51, 52, 54, 61, 62, 63, 64, 67, 69, 70, 73, 76, 77, 81, 86, 88, 90, 92, 94, 97, 110, 124, 125, 129

Cell B4 desired result (just the amounts that are common to cells B1, B2, and B3)
9, 41, 45, 92

Cell B5 desired result (the number of amounts that are common to cells B1, B2, and B3)
4
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about
Excel Formula:
=LET(a,VSTACK(TRIM(TEXTSPLIT(TEXTJOIN(", ",,B1:B3),,","))),b,UNIQUE(FILTER(a,MMULT(--(a=TRANSPOSE(a)),SEQUENCE(ROWS(a),,,0))=3)),VSTACK(TEXTJOIN(", ",,b),ROWS(b)))
 
Upvote 0
It seems I don't have the VSTACK function.

I do have a current 365 subscription.

Thanks for this incredible formula.
 
Upvote 0
Ok, how about
Excel Formula:
=LET(a,FILTERXML("<k><m>"&SUBSTITUTE(TEXTJOIN(", ",,B1:B3),",","</m><m>")&"</m></k>","//m"),b,UNIQUE(FILTER(a,MMULT(--(a=TRANSPOSE(a)),SEQUENCE(ROWS(a),,,0))=3)),CHOOSE({1;2},TEXTJOIN(", ",,b),ROWS(b)))
 
Upvote 0
Solution
Ok, how about
Excel Formula:
=LET(a,FILTERXML("<k><m>"&SUBSTITUTE(TEXTJOIN(", ",,B1:B3),",","</m><m>")&"</m></k>","//m"),b,UNIQUE(FILTER(a,MMULT(--(a=TRANSPOSE(a)),SEQUENCE(ROWS(a),,,0))=3)),CHOOSE({1;2},TEXTJOIN(", ",,b),ROWS(b)))
Perfect, that does it! Thank you!
 
Last edited by a moderator:
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,517
Messages
6,125,288
Members
449,218
Latest member
Excel Master

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