Array formula question

Charlie1957

New Member
Joined
Nov 12, 2016
Messages
8
Good afternoon:
I think I can’t use a vlookup since that only returns the first value, right? For many of the Purchase order in the 2nd file – there are multiple commodities.
I did some research – would an array formula work maybe?
<o:p> </o:p>
My goal is to add a commodity description to the 2nd file below for each commodity in a purchase order.
<o:p> </o:p>
So anytime the PO # matches between the 2 files I want all the cmdty descriptions in the first file to be copied to the cmdty description column in the 2nd file. If I do a vlookup, I will get only the first value which is no good if there are multiple commodities per purchase order.

1st file:
PO # Cmdty Desc
100 ABC
101 DEF
101 FFF
101 GGG
102 XXX

2nd File

PO# Cmdty Descr.
100 wil have 1 descr. copied
101 will have 3 descr, copied for 1st file
102 will have 1 descr, copied.

Thanks so much!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Here are a couple of ways:


Book1
ABCDEFGH
1PO #Cmdty DescPO#Cmdty Desc
2100ABC101DEF, FFF, GGG
3101DEF101DEFFFFGGG
4101FFF
5101GGG
6102XXX
Sheet3
Cell Formulas
RangeFormula
F2{=TEXTJOIN(", ",TRUE,IF(A2:A6=E2,B2:B6,""))}
F3{=IFERROR(INDEX($B$2:$B$6,SMALL(IF($A$2:$A$6=$E3,ROW($A$2:$A$6)-ROW($A$2)+1),COLUMNS($F3:F3))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.



If you have Excel 2016 with the new TEXTJOIN function, you can use the formula in F2. Since it's an array formula, confirm with Control+Shift+Enter.

If you have an older version of Excel, you can use the formula in F3, confirm with CSE, and copy it to the right as far as needed. If you want the different values concatenated into a single cell like in F2, we'd need to add a helper row.

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

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