SOLVED

Why do some functions spill automaticly, and others not?

%3CLINGO-SUB%20id%3D%22lingo-sub-1493737%22%20slang%3D%22en-US%22%3EWhy%20do%20some%20functions%20spill%20automaticly%2C%20and%20others%20not%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493737%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20attached%20eacamle%20there%20is%20some%20function%20that%20automaticly%20fill%20down%20the%20list%20of%20names%2C%20and%20others%20do%20not.%20Why%20is%20that%3F%20The%20functions%20in%20the%20yellow%20cells%20spill%3A%3C%2FP%3E%3CP%3ECountIf%2C%20SumIf%3B%20Sum.%20Is%20it%20possible%20to%20make%20Sumproduct%20.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUpdate%2C%20Maxifs%2C%20solved%20find%20the%20largest%20number%20problem.%20So%20Its%20sumproduct%20thats%20the%20question.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20see%20attached%20excample.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20Regards%3C%2FP%3E%3CP%3E-%20Geir%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1493737%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1494339%22%20slang%3D%22en-US%22%3ERe%3A%20Why%20do%20some%20functions%20spill%20automaticly%2C%20and%20others%20not%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1494339%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9195%22%20target%3D%22_blank%22%3E%40Geir%20Hogstad%3C%2FA%3E%26nbsp%3BThis%20is%20what%20the%20MS%20support%20pages%20write%20about%20SUMPRODUCT%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EThe%20%3CSTRONG%3ESUMPRODUCT%3C%2FSTRONG%3E%26nbsp%3Bfunction%20returns%20the%20sum%20of%20the%20products%20of%20corresponding%20ranges%20or%20arrays.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20that's%20exactly%20what%20it%20does.%20A%20sum%20formula%20returns%20a%20%3CSTRONG%3Esingle%3C%2FSTRONG%3E%20value%2C%20not%20an%20array%20of%20values.%20In%20E5%2C%20the%20FILTER%20function%20returns%20an%20array%20(1%20row%2C%203%20columns)%20based%20on%20a%20criteria%20(Jan%3AMar%20for%20sales%20person%20Hansen)%20and%20the%20SUMPRODUCT%20sums%20up%20the%20filtered%20values.%26nbsp%3BBy%20the%20way%2C%20in%20this%20particular%20example%20where%20you%20only%20sum%20one%20range%2C%20you%20can%20also%20just%20use%20SUM.%20It%20gives%20the%20same%20result.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERevised%20your%20file%20to%20demonstrate%20how%20it%20would%20work.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1494639%22%20slang%3D%22en-US%22%3ERe%3A%20Why%20do%20some%20functions%20spill%20automaticly%2C%20and%20others%20not%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1494639%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9195%22%20target%3D%22_blank%22%3E%40Geir%20Hogstad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGeir%2C%20if%20return%20the%20spill%20of%20sums%20like%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20362px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F201756i5DD72CAD4A29769F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Ewhen%20MMULT%20is%20usually%20used.%20In%20this%20case%2C%20in%20addition%20to%20avoid%20INDIRECT()%2C%20formula%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DMMULT(--INDEX(A_selgere%2CXMATCH(C5%23%2CA_selgere%5BSelger%5D%2C0)%2CSEQUENCE(1%2CXMATCH(%24D%242%2C%20A_selgere%5B%23Headers%5D)-1%2C2))%2CSEQUENCE(XMATCH(%24D%242%2C%20A_selgere%5B%23Headers%5D)-1%2C1%2C1%2C0))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EDouble%20dash%20is%20needed%20to%20convert%20blank%20cells%20to%20zero%2C%20otherwise%20MMULT%20returns%20an%20error.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20spill%20the%20max%20use%20usual%20MAXIFS%2C%20FILTER%20is%20not%20required%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DMAXIFS(A_ordre%5BOmsetning%5D%2CA_ordre%5BSelger%5D%2CC5%23)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

Hi,

 

In the attached eacamle there is some function that automaticly fill down the list of names, and others do not. Why is that? The functions in the yellow cells spill:

CountIf, SumIf; Sum. Is it possible to make Sumproduct .

 

Update, Maxifs, solved find the largest number problem. So Its sumproduct thats the question.

 

 

 

Please see attached excample.

 

Best Regards

- Geir

 

 

2 Replies
Highlighted

@Geir Hogstad This is what the MS support pages write about SUMPRODUCT

 

The SUMPRODUCT function returns the sum of the products of corresponding ranges or arrays.

 

And that's exactly what it does. A sum formula returns a single value, not an array of values. In E5, the FILTER function returns an array (1 row, 3 columns) based on a criteria (Jan:Mar for sales person Hansen) and the SUMPRODUCT sums up the filtered values. By the way, in this particular example where you only sum one range, you can also just use SUM. It gives the same result.

 

Revised your file to demonstrate how it would work.

Highlighted
Best Response confirmed by Geir Hogstad (Frequent Contributor)
Solution

@Geir Hogstad 

Geir, if return the spill of sums like

image.png

when MMULT is usually used. In this case, in addition to avoid INDIRECT(), formula could be

=MMULT(--INDEX(A_selgere,XMATCH(C5#,A_selgere[Selger],0),SEQUENCE(1,XMATCH($D$2, A_selgere[#Headers])-1,2)),SEQUENCE(XMATCH($D$2, A_selgere[#Headers])-1,1,1,0))

Double dash is needed to convert blank cells to zero, otherwise MMULT returns an error.

 

To spill the max use usual MAXIFS, FILTER is not required

=MAXIFS(A_ordre[Omsetning],A_ordre[Selger],C5#)