Select one entry per group

A

AJ

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.
 
S

Squeaky

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top