Issue with Array Formula to return list of text items separated by a comma

vaibhavgarg

New Member
Joined
Mar 2, 2017
Messages
2
I have a list of from and to dates of employment against a list of names in a sheet.
I have another set of from and to dates in a second sheet. I need to find out the names of people in the first sheet that were employed during that period; preferable separated by a comma.

I have array entered the following formula in a cell in sheet 2

=CONCAT(INDEX(Name,AGGREGATE(15,6,(1/(((A4<todate)*(b4>FromDate))>0))*ROW(FromDate)-2,{1,2,3,4})))

a4 and b4 are from and to dates from the second sheet respectively.

The issue is that the index function returns only the first value. I have tried transposing the array both as arguments of the aggregate function and the net output; but to no avail.

the file is here:
https://www.dropbox.com/s/izzx7isztnzejlj/test file.xlsx?dl=0

See Cell H2 in sheet "data" for this formula.

Please help in deciphering this mystery.</todate)*(b4>
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I managed to figure it out.
Actually, the INDEX function does not return an array by default and has to be coerced into doing so. I used the technique illustrated in this article.

This is what I came up with:
=TEXTJOIN(", ",TRUE,INDEX(Name,N(IF(1,AGGREGATE(15,6,(1/(((A4<todate)*(b4>FromDate))>0))*ROW(FromDate)-2,ROW(OFFSET($A$1,,,COUNT((1/(((A4<todate)*(b4>FromDate))>0))))))))))

Works like a charm. I am sure this can be simplified a lot, but this gets the job done.
Thanks.</todate)*(b4></todate)*(b4>
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,891
Members
449,194
Latest member
JayEggleton

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