You will have to use an array formula. Here's what you do.
Let's assume A1 is a header name "Box No." and B1 is a header name Product.
We're going to skip over column C and start your report in column D.
First, you need to filter column B for unique records. Put that list
wherever you like on the page (down in A100 is fine).
Take that list, delete the header, and sort it. Then cut the list, go to
cell E1, and Paste Special -> Transpose.
Now all your unique products are across the top in E1, F1, G1, etc.
In D2, enter "Total Boxes" without quotes and right align it.
In D3, enter "Box List" without quotes and right align it.
In E2, =COUNTIF(B:B,E1) and use the fill handle to drag that formula across
for all your products. You might change the format of your first two rows
to make them stand out as your header (bold font and colored background).
Now for the list you are looking for.
In E3, you have to enter an array formula, which is committed using
Ctrl+Shift+Enter (or CSE).
So in E3, =INDEX(A:A,SMALL(IF($B$2:$B$1000=E$1,ROW($2:$1000)),ROW(2:2))) and
don't forget to CSE.
Now use the fill handle to drag this formula across as many columns as you
need and down as many rows as you think you'll need (for instance, if you'll
have no more than 20 boxes at a time of any one product, drag the formula
down 25 rows to be safe).
You will get the #NUM! error once you run out of boxes, so you'll want to
conditional format those cells. Highlight E3 to the end of your range and
then Format -> Conditional Format -> Formula Is =ISERROR(E3) then change the
font to white.
You're done!!!
- KC
> Hi Bernard,
> Thanks for your reply, I have tried your solution but I can only find
[quoted text clipped - 4 lines]
> Thanks
> Colin
KC Rippstein - 05 Jan 2007 16:04 GMT
One more thing...you should change my 1000 boxes assumption to something
more reasonable for you. If you'll never have more than 500 boxes of
inventory at any time, then end the array formula at row 600 instead of
1000.
Array formulas look at every row one at a time to run the test. So in the
example I gave you, it would search all 1000 rows 25 times for each product.
So it is performing 25,000 calculations per product times every single
product every time you update your list. As you can imagine, it takes a
little time to perform 25,000 calculations times 20 products (or half a
million calculations), so be sure to keep that array formula within as
reasonable a constraint as makes sense for your business.
> You will have to use an array formula. Here's what you do.
> Let's assume A1 is a header name "Box No." and B1 is a header name
[quoted text clipped - 35 lines]
>> Thanks
>> Colin