ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Select one entry per group (https://www.excelbanter.com/excel-discussion-misc-queries/196587-select-one-entry-per-group.html)

AJ[_4_]

Select one entry per group
 
I have a column that contains product codes. Each product code may have
several rows of data but the product code stays constant from row to row
within the group. Is there a way that I can do a vlookup to only pick up the
product code only once from each group? (The product codes can vary from
month to month so I don't want to hard code anything.)

Example:

A008
A008
A008
A008
A010
A010
A010
A012
A013
A013
A Total

I would like to pull A008, A010, A012, A013 & A Total,......

Any help would be appreciated.





--
AJ

Squeaky

Select one entry per group
 
This is a formula I picked up from here and I am able to make it work just as
you are wanting.
Assuming your Product codes are in cells d3:d12. In adjacent cells ("E3" in
this ex. -you can hide them later) put without the {} brackets:

{=INDEX($D$3:$D$12,MIN(IF((COUNTIF($E$2:E2,$D$3:$D $12)=0)*($D$3:$D$12<""),ROW($D$3:$D$12)))-MIN(ROW($D$3:$D$12))+1)}

Use CTR-SHIFT-ENTER to enter the formula as an array. You will get the
brackets on the ends. Drag this down to the cell across from the last Product
code. You will get the single codes followed by #Value! in the rest of the
cells. In the F column put the formula:

=IF(ISERR(E3),"",E3) and drag it down to g12.

Make your drop down box to link to the range F3:F12.

You can adjust this to fit your size and needs.

Squeaky

"AJ" wrote:

I have a column that contains product codes. Each product code may have
several rows of data but the product code stays constant from row to row
within the group. Is there a way that I can do a vlookup to only pick up the
product code only once from each group? (The product codes can vary from
month to month so I don't want to hard code anything.)

Example:

A008
A008
A008
A008
A010
A010
A010
A012
A013
A013
A Total

I would like to pull A008, A010, A012, A013 & A Total,......

Any help would be appreciated.





--
AJ



All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com