Needed: An Array Formula that returns distinct items from a list

pdx2dca

New Member
Joined
Oct 31, 2017
Messages
10
I need an array function that works much like the column grouping function of a pivot table.


For example: Referencing the list of items below...
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Mary[/TD]
[/TR]
[TR]
[TD]Mary[/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[/TR]
[TR]
[TD]John[/TD]
[/TR]
[TR]
[TD]John[/TD]
[/TR]
[TR]
[TD]John[/TD]
[/TR]
</tbody>[/TABLE]



...is there an array formula that would return the three distinct items ("Bob", "Mary", "John") from the list? The resulting array would be three cells long, one cell for each distinct item (example below)
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Mary[/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[/TR]
[TR]
[TD]John[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Let A2:A6 house the data.

In D1 control+shift+ente, not just enter:

=SUM(IF(FREQUENCY(IF(1-($A$2:$A$6=""),MATCH($A$2:$A$6,$A$2:$A$6,0)),ROW($A$2:$A$6)-ROW($A$2)+1),1))

In D2 control+shift+enter, not just enter, and copy down:

=IF(ROWS($D$2:D2)>$D$1,"",INDEX($A$2:$A$6,SMALL(IF(FREQUENCY(IF(1-($A$2:$A$6=""),MATCH($A$2:$A$6,$A$2:$A$6,0)),ROW($A$2:$A$6)-ROW($A$2)+1),ROW($A$2:$A$6)-ROW($A$2)+1),ROWS($D$2:D2))))
 
Upvote 0
That does it. Thanks much.

I looked into using FREQUENCY, but couldn't figure out how to make it work with text. Plus, I misunderstood what the 'bins_array' entry was meant to do.

Thanks again.
 
Upvote 0
That does it. Thanks much.

I looked into using FREQUENCY, but couldn't figure out how to make it work with text. Plus, I misunderstood what the 'bins_array' entry was meant to do.

Thanks again.

You are welcome. Thanks for the update.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

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