简体   繁体   中英

Returning multiple ID numbers in Excel using an Array

I am working with a set of data in Excel that includes ID numbers and Account numbers. Each ID number contains multiple account numbers. I want to return each Account number associated with each ID number vertically.

I have done research and came up with an array formula that works for the first ID number but does not work for the rest. I have created a sample of my data to share.

{=INDEX($E$2:$E$5, SMALL(IF(($H2=$A$2:$C$5), MATCH(ROW($A$2:$C$5), ROW($A$2:$C$5)), ""), ROWS($A$1:A1)))}

I am getting a #NUM! error in the rest of the cells. Any help would be greatly appreciated.

sample data - formula result - desired result

样本数据-公式结果-所需结果

Using your provided data setup like so:

在此处输入图片说明

In cell H2 and copied down is this (regular) formula (assumes ID #s are actually numbers as shown in your provided sample data):

=IF(ROW(H1)>COUNTA($A$2:$C$5),"",SMALL($A$2:$C$5,ROW(H1)))

Then in cell I2 and copied down is this ( array ) formula:

=IF(H2="","",INDEX(E:E,SMALL(IF($A$2:$C$5=H2,ROW($A$2:$C$5)),COUNTIF(H$2:H2,H2))))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM