Produce a new list based on values in a range

bj6264

Board Regular
Joined
May 23, 2010
Messages
50
Hello,

I have a very long list of products and values and I need to produce another list that list products by a range of quantity. My list looks similar to this:-

[TABLE="width: 158"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Potatoes[/TD]
[TD="align: right"]199[/TD]
[/TR]
[TR]
[TD]Peas[/TD]
[TD="align: right"]152[/TD]
[/TR]
[TR]
[TD]Carrots[/TD]
[TD="align: right"]1901[/TD]
[/TR]
[TR]
[TD]Cabbage[/TD]
[TD="align: right"]576[/TD]
[/TR]
[TR]
[TD]Turnip[/TD]
[TD="align: right"]800[/TD]
[/TR]
[TR]
[TD]Cucumber[/TD]
[TD="align: right"]100
[/TD]
[/TR]
</tbody>[/TABLE]

I then need to produce a list that has headers of "less than 100", "101 to 200" etc and under each header the product would appear

[TABLE="width: 336"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Less than 100[/TD]
[TD]100-199[/TD]
[TD]200-299[/TD]
[TD]500 - 599[/TD]
[TD]etc[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Cucumber[/TD]
[TD][/TD]
[TD]Cabbage[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Peas[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Can I use a formula to do this? Thought of nested ifs but as my values go up to about 3000 not sure if this would fit. Think offset may work but not sure of how.

Hope this makes sense!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
How about


Book1
ABCDEFGHIJK
1Less than 100100-199200-299300-399400-499500-599
2Potatoes199 PotatoesCabbage
3Peas152Peas
4Carrots1901
5Cabbage576
6Turnip800
7Cucumber100
Lists
Cell Formulas
RangeFormula
F2=IFERROR(INDEX($A$2:$A$100,AGGREGATE(15,6,(ROW($A$2:$A$100)-ROW($A$2)+1)/(($B$2:$B$100A1)*100)*($B$2:$B$100>=COLUMN(A1)*100-99)),ROWS(F$2:F2))),"")


Fill formula down & across
 
Upvote 0
How about

ABCDEFGHIJK
Less than 100100-199200-299300-399400-499500-599
PotatoesPotatoesCabbage
PeasPeas
Carrots
Cabbage
Turnip
Cucumber

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]199[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]152[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]1901[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]576[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]800[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]100[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Lists

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]F2[/TH]
[TD="align: left"]=IFERROR(INDEX($A$2:$A$100,AGGREGATE(15,6,(ROW($A$2:$A$100)-ROW($A$2)+1)/(($B$2:$B$100<COLUMN(A1)*100)*($B$2:$B$100>=COLUMN(A1)*100-99)),ROWS(F$2:F2))),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



Fill formula down & across

Thank you Fluff you're a genius! You've helped me again. Many, many thanks. Bj
 
Upvote 0
You're wlecome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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