Automatically copy range of cells to cells of same sheet

toant

New Member
Joined
Apr 24, 2021
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hi. I would sort by categories a range of cells to sub tables on the same sheet. I have attached a few pictures as examples to better explain my scenario. Please note "x" are just placeholders fields that some text will be entered later.

Criteria:

1) Automatically place each Item and range from Item==>Quantity it to each corresponding category "sub table" on the same sheet (i.e. all ice cream goes together and all Fruit goes together)
2) Any duplicate Items will not have another line but rather be combined and quantity added (note: highlighted quantity is just for reference that the quantity has been added)
3) If an Item is removed from the main table, it will automatically be removed from the sub table or substracted from the quantity.

Any help is appreciated. I would prefer not to use Macros for this.

Thank you in advance.


Shelf.png


Items sort -Before.png

Items sort -After.png
 
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also are you happy to change the layout of your data?
Thanks for the heads up. I updated the account.

The layout can be changed as long as the freezer column and shelf rows stay the same. The data on the bottom as to where the copied cells will go can be fully altered as long as they can be group someway. Ideally I want to show a sum and have a pie chart depiction of the categories so we can visually see the inventory.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Thanks for that, can we get rid of the merged cells?
Also where you have an "x" will that always be the same for each item?
 
Upvote 0
Thanks for that, can we get rid of the merged cells?
Also where you have an "x" will that always be the same for each item?
Yes merged cells can be removed. x will be different values specific to each row such as lot number and expiration.
 
Upvote 0
If you had something like this
Freezer .xlsx
BCDEF
2Freezer 1
3Category ItemLotDateQuantity
4Ice CreamVanillaA01/01/20215
5FruitStrawberryxx2
6Meat Chickenxx4
7Ice CreamVanillaB07/03/20217
8Ice CreamVanillaA01/01/20216
Sheet1


How would you want it displayed?

Freezer .xlsx
CDEF
54Option A
55Vanilla18
56
57
58Option B
59VanillaA01/01/202111
60VanillaB07/03/20217
61
62
63Option C
64VanillaA01/01/202118
Sheet1
 
Upvote 0
If you had something like this
Freezer .xlsx
BCDEF
2Freezer 1
3Category ItemLotDateQuantity
4Ice CreamVanillaA01/01/20215
5FruitStrawberryxx2
6Meat Chickenxx4
7Ice CreamVanillaB07/03/20217
8Ice CreamVanillaA01/01/20216
Sheet1


How would you want it displayed?

Freezer .xlsx
CDEF
54Option A
55Vanilla18
56
57
58Option B
59VanillaA01/01/202111
60VanillaB07/03/20217
61
62
63Option C
64VanillaA01/01/202118
Sheet1
option C
 
Upvote 0
Ok, how about
Freezer .xlsx
ABCDEFGHIJKLMNOPQRSTU
1
2Freezer 1Freezer 2Refrigerator 1Freezer 4
3Category ItemxxQuantityCategory ItemxxQuantityCategory ItemxxQuantityCategory ItemExpirationQuantity
4SHELF 1Ice CreamVanillaxx5VegetablePeasxx6MeatSteakxx60
5FruitStrawberryxx2Ice CreamChocolatexx8FishHalibutxx70
6Meat Chickenxx4MeatSteakxx9MeatChickenxx50
70000
80000
90000
100000
110000
120000
130000
14SHELF 2FishHalibutxx2Ice CreamVanillaxx7VegetableBroccolixx80
15VegetableCornxx70FruitStrawberryxx50
16MeatPork Ribsxx5000
170000
180000
190000
200000
210000
220000
230000
24SHELF 30000
250000
260000
270000
280000
290000
300000
310000
320000
330000
34SHELF 40000
350000
360000
370000
380000
390000
400000
410000
420000
430000
44SHELF 50000
450000
460000
470000
480000
490000
500000
510000
520000
530000
Sheet1
Cell Formulas
RangeFormula
F7:F13,U4:U53,P16:P53,K15:K53,F17:F53,P7:P13,K7:K13F7=D7*E7

Freezer .xlsx
ABCDEFGHIJKLMNOP
70Ice CreamFruitMeat
71ItemxxQuantityItemxxQuantityItemxxQuantity
72Vanillaxx12Strawberryxx7Pork Ribsxx5
73Chocolatexx8Steakxx15
74Chickenxx9
75
76
77
78
79
80
81
82
83
84FishDairyVegetable
85ItemxxQuantityItemxxQuantityItemxxQuantity
86Halibutxx9 Cornxx7
87Peasxx6
88Broccolixx8
89
90
91
92
93
94
95
96
Sheet1
Cell Formulas
RangeFormula
C72:F73C72=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=C70),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
H72:K72H72=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=H70),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
M72:P74M72=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=M70),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
C86:F86C86=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=C84),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
H86:K86H86=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=H84),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
M86:P88M86=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=M84),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
Dynamic array formulas.
 
Upvote 0
Solution
However it would be a lot simpler if you changed the layout like
Freezer .xlsx
ABCDEF
1
2Freezer 1
3Category ItemxxQuantity
4SHELF 1Ice CreamVanillaxx5
5FruitStrawberryxx2
6Meat Chickenxx4
70
80
90
100
110
120
130
14SHELF 2FishHalibutxx2
15VegetableCornxx7
16MeatPork Ribsxx5
170
180
190
200
210
220
230
24SHELF 30
250
260
270
280
290
300
310
320
330
34SHELF 40
350
360
370
380
390
400
410
420
430
44SHELF 50
450
460
470
480
490
500
510
520
530
54Freezer 2
55Category ItemxxQuantity
56SHELF 1VegetablePeasxx6
57Ice CreamChocolatexx8
58MeatSteakxx9
590
600
610
620
630
640
650
66SHELF 2Ice CreamVanillaxx7
670
680
690
700
710
720
730
740
750
76SHELF 30
770
780
790
800
810
820
830
840
850
86SHELF 40
870
880
890
900
910
920
930
940
950
96SHELF 50
970
980
990
1000
1010
1020
1030
1040
1050
Sheet1 (2)
Cell Formulas
RangeFormula
F7:F13,F67:F105,F59:F65,F17:F53F7=D7*E7

Freezer .xlsx
HIJK
70Ice Cream
71ItemxxQuantity
72Vanillaxx12
73Chocolatexx8
74
75
76
77
78
79
80
81
82
Sheet1 (2)
Cell Formulas
RangeFormula
H72:H73H72=UNIQUE(FILTER(C4:C100,B4:B100=B57))
I72:J73I72=XLOOKUP($H72#,$C$2:$C$100,D2:D100,"",0)
K72:K73K72=SUMIFS(F:F,C:C,H72#)
Dynamic array formulas.
 
Upvote 0
Ok, how about
Freezer .xlsx
ABCDEFGHIJKLMNOPQRSTU
1
2Freezer 1Freezer 2Refrigerator 1Freezer 4
3Category ItemxxQuantityCategory ItemxxQuantityCategory ItemxxQuantityCategory ItemExpirationQuantity
4SHELF 1Ice CreamVanillaxx5VegetablePeasxx6MeatSteakxx60
5FruitStrawberryxx2Ice CreamChocolatexx8FishHalibutxx70
6Meat Chickenxx4MeatSteakxx9MeatChickenxx50
70000
80000
90000
100000
110000
120000
130000
14SHELF 2FishHalibutxx2Ice CreamVanillaxx7VegetableBroccolixx80
15VegetableCornxx70FruitStrawberryxx50
16MeatPork Ribsxx5000
170000
180000
190000
200000
210000
220000
230000
24SHELF 30000
250000
260000
270000
280000
290000
300000
310000
320000
330000
34SHELF 40000
350000
360000
370000
380000
390000
400000
410000
420000
430000
44SHELF 50000
450000
460000
470000
480000
490000
500000
510000
520000
530000
Sheet1
Cell Formulas
RangeFormula
F7:F13,U4:U53,P16:P53,K15:K53,F17:F53,P7:P13,K7:K13F7=D7*E7

Freezer .xlsx
ABCDEFGHIJKLMNOP
70Ice CreamFruitMeat
71ItemxxQuantityItemxxQuantityItemxxQuantity
72Vanillaxx12Strawberryxx7Pork Ribsxx5
73Chocolatexx8Steakxx15
74Chickenxx9
75
76
77
78
79
80
81
82
83
84FishDairyVegetable
85ItemxxQuantityItemxxQuantityItemxxQuantity
86Halibutxx9 Cornxx7
87Peasxx6
88Broccolixx8
89
90
91
92
93
94
95
96
Sheet1
Cell Formulas
RangeFormula
C72:F73C72=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=C70),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
H72:K72H72=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=H70),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
M72:P74M72=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=M70),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
C86:F86C86=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=C84),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
H86:K86H86=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=H84),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
M86:P88M86=LET(Rng,(B4:U53),Rws,ROWS(Rng),Cols,5,Seq,SEQUENCE(COLUMNS(Rng)*Rws/Cols,,0),Ary,INDEX(Rng,MOD(Seq,Rws)+1,(INT(Seq/Rws))*Cols+SEQUENCE(,Cols)),Fltr,FILTER(FILTER(Ary,INDEX(Ary,,1)=M84),{0,1,1,1,0}),Uni,UNIQUE(INDEX(Fltr,,1)),IFERROR(CHOOSE({1,2,3,4},Uni,VLOOKUP(Uni,Fltr,2,0),VLOOKUP(Uni,Fltr,3,0),IF(ROWS(Fltr)=0,"",SUMIFS(F4:U53,C4:R53,Uni))),""))
Dynamic array formulas.
Thank you for your help! This worked perfectly.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,692
Members
449,117
Latest member
Aaagu

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