SOLVED

Summarise data and group together

%3CLINGO-SUB%20id%3D%22lingo-sub-3064340%22%20slang%3D%22en-US%22%3ESummarise%20data%20and%20group%20together%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3064340%22%20slang%3D%22en-US%22%3E%3CP%3EHello!%20i%20was%20wondering%20if%20something%20like%20this%20is%20possible.%20we%20have%20a%20food%20menu%20for%20ordering.%20when%20the%20orders%20are%20placed%20on%20the%20top%20tables%2C%20i%20want%20then%20a%20formula%20or%20function%20to%20summarize%20the%20orders%20and%20create%20totals%20for%20each%20item.%20an%20example%20of%20what%20i%20want%20is%20on%20the%20screenshot%20below%2C%20i've%20filled%20in%20the%20first%20table%20(monday)%20to%20better%20understand%20what%20the%20bottom%20table(monday)%20s%E2%80%83hould%20look%20like.%20unfortnetely%20i%20cannot%20use%20macros%20for%20this%2C%20so%20i%20need%20to%20have%20a%20formula.%20i'm%20using%20Microsoft%20Office%20365%20for%20business.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222022-01-18_12h22_10.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F340274i86FD99D23EEA4E77%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%222022-01-18_12h22_10.png%22%20alt%3D%222022-01-18_12h22_10.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3064340%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3064348%22%20slang%3D%22en-US%22%3ERe%3A%20Summarise%20data%20and%20group%20together%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3064348%22%20slang%3D%22en-US%22%3Eplease%20note%20that%20menu%20items%20are%20not%20fixed.%20many%20other%20options%20can%20be%20added.%20for%20example%20if%20one%20user%20adds%20pizza%20on%20the%20mains%2C%20then%20an%20automatic%20cell%20on%20the%20bottom%20table%20should%20be%20created%20and%20next%20to%20it%20the%20total%2C%20in%20this%20case%201.%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello! i was wondering if something like this is possible. we have a food menu for ordering. when the orders are placed on the top tables, i want then a formula or function to summarize the orders and create totals for each item. an example of what i want is on the screenshot below, i've filled in the first table (monday) to better understand what the bottom table(monday) should look like. unfortnetely i cannot use macros for this, so i need to have a formula. i'm using Microsoft Office 365 for business. 

2022-01-18_12h22_10.png

 

10 Replies
please note that menu items are not fixed. many other options can be added. for example if one user adds pizza on the mains, then an automatic cell on the bottom table should be created and next to it the total, in this case 1.

@aavgoustinoss  You can use COUNTIF for this, and since you use MS365, you can make use of spilling dynamic array functions.

Riny_van_Eekelen_0-1642503316697.png

File attached.

 

@aavgoustinoss 

As variant, if like this

image.png

=LET(
 n,          ROWS(dataMonday),
 main,       INDEX(dataMonday,0,1),
 Side1,      INDEX(dataMonday,0,2),
 Side2,      INDEX(dataMonday,0,3),
 nameMain,   UNIQUE(main),
 countMain,  MMULT(--(nameMain=TRANSPOSE(main)), SEQUENCE(n,,1,0)),
 nameSide1,  UNIQUE(Side1),
 countSide1, MMULT(--(nameSide1=TRANSPOSE(Side1)), SEQUENCE(n,,1,0)),
 nameSide2,  UNIQUE(Side2),
 countSide2, MMULT(--(nameSide2=TRANSPOSE(Side2)), SEQUENCE(n,,1,0)),
 mMain,      ROWS(nameMain),
 mSide1,     ROWS(nameSide1),
 mSide2,     ROWS(nameSide2),
 k,          SEQUENCE(mMain+mSide1+mSide2),
 names,      IF( k <= mMain, INDEX(nameMain, k),
             IF( k<= mMain+mSide1, INDEX(nameSide1, k-mMain),
                 INDEX(nameSide2, k-mMain-mSide1))),
 counts,      IF( k <= mMain, INDEX(countMain, k),
              IF( k<= mMain+mSide1, INDEX(countSide1, k-mMain),
                  INDEX(countSide2, k-mMain-mSide1))),
 IF({1,0}, names, counts)  )

 

thank you, this has helped me a lot!
thank you @Sergei! thats a great formula you've added!

@Sergei Baklan the solution seems to work, but it also counts cells with no value. is there a way to skip it when the value is an empty cell?

@aavgoustinoss 

Got it, will update bit later today.

best response confirmed by aavgoustinoss (Occasional Contributor)
Solution

@aavgoustinoss 

It's like

image.png

with

=LET(
 main,        LET(t, INDEX(dataMonday,0,1), FILTER(t,  t<>"") ),
 Side1,       LET(t, INDEX(dataMonday,0,2), FILTER(t,  t<>"") ),
 Side2,       LET(t, INDEX(dataMonday,0,3), FILTER(t,  t<>"") ),
 nA,          ROWS(main),
 nB,          ROWS(Side1),
 nC,          ROWS(Side2),
 n,           nA + nB + nC,
 j,           SEQUENCE(n),
 fullList,    IF( j <= nA, INDEX(main, j),
              IF( j<= nA+nB, INDEX(Side1, j-nA),
                  INDEX( Side2, j-nA-nB) ) ),
 names,       UNIQUE(fullList),
 countNames,  MMULT(--(names=TRANSPOSE(fullList)), SEQUENCE(n,,1,0)),
 IF({1,0}, names, countNames) )
thank you works perfectly!

@aavgoustinoss , you are welcome