I can't figure out how to make an array formula with a SUMIFS function.
I want my results from SUMIFS to be ponderated by a ratio.
See atatched example file.
Have a nice week-end!
Nicolas
Here follow a link to the example: enter link description here
You can't use an array in SUMIFS.
Use SUMPRODUCT:
=SUMPRODUCT(F4:F16,G4:G16,(C4:C16=K4)*(D4:D16=K5))
Related
How to text join all negative value references?
Using textjoin function or any other function in Excel. (without VBA code)
You can use formula suggested by JvdV. You can also try TEXTJOIN() with FILTER() formula.
=TEXTJOIN("|",TRUE,FILTER(A2:A7,C2:C7<0))
So, had a quick play and this works:
Only did the first 3 but if() and iferror() or isblank() come to mind if there is only one, two etc results to avoid repeating | without names...
Note, the formula shown in C1 should be SMALL(... not LARGE(...
I have a dynamic formula in google sheet that splits a rept string into multiple columns using this formula: =split(rept(A1,B1)," ").
But I can't seem to figure out how to do this in excel. Any suggestion would be helpful.
https://docs.google.com/spreadsheets/d/1IcIvhuwA3z2lngz-l4TwuenPgCMOGdCwe_Ukhu_f5zQ/edit?usp=sharing
If you have SEQUENCE() function access then try-
=TRANSPOSE(INDEX(A1,SEQUENCE(B1,,,0)))
You could use FILTERXML() to mimic a split funcitonality:
Formula in A3:
=TRANSPOSE(FILTERXML("<t><s>"&REPT(A1&"</s><s>",B1)&"</s></t>","//s[.!='']"))
The above will spill the returned array horizontally using Microsoft365. If you don't have acces to dynamic array funtionality, you could use indices to return values from the resulting array.
For further explainations and examples using FILTERXML() I'd like to refer you to this Q&A on the topic.
=SUMIF(A1:A14, "102000*", B1:B14)
Why it cannot filter the value starts with 10200?
An array (CSE) formula solves the issue:
How it works:
Suppose you want to add numbers like 1020001, then enter it as criteria in cell D74, and use this formula.
{=SUM((B74:B82)*(--(A74:A82=D74)))}
If you have more criteria, like I've shown in D74 & in E74, then use this one in C74.
{=SUM((B74:B82)*(--(A74:A82=D74)+(--(A74:A82=E74))))}
N.B.
Finish formula with Ctrl+Shift+Enter.
You may adjust cell references in the formula as needed.
You are better off creating a new column using the formula
left(a1,5)
Then base the sumif off that new column.
If you want to count the number of occurences, you can use
=SUMPRODUCT(--(--LEFT(A1:A7,5)=10200))
and if you actually want to sum values, use
=SUMPRODUCT(--(--LEFT(A1:A7,5)=10200)*(B1:B7))
Tryingto CountIf with Exclusions and multiple criteria,
Here's an example of just multiple critera:
=SUM(COUNTIFS(A1:A9,"YES",B1:B9,{"JOHN","GEORGE","RINGO","PAUL"}))
Here's an example of just exlusion:
=SUM(COUNTIFS(A1:A9,"YES",B1:B9,"<>*JOHN*"))
And here's the sum we're currently got but not working:
=SUM(COUNTIFS(A1:A9,"YES",B1:B9,{"<>*JOHN*","<>*GEORGE*","<>*RINGO*","<>*PAUL*"}))
When criteria becomes too complex for COUNTIFS, you can often use an array formula. I think the following array formula will achieve your goal...
=SUM(IF(A1:A9="YES",1,0)*(IF(ISNUMBER(FIND("JOHN",B1:B9)),0,1))*(IF(ISNUMBER(FIND("GEORGE",B1:B9)),0,1))*(IF(ISNUMBER(FIND("RINGO",B1:B9)),0,1))*(IF(ISNUMBER(FIND("PAUL",B1:B9)),0,1)))
Make sure to use CTRL+SHIFT+ENTER to enter the array formula.
Basically, I want to do a SUMIF, but I need to enter an equation for sum_range parameter, so normally, to do a SUMIF, you write:
=SUMIF(CRITERIA_RANGE,CRITERIA,SUM_RANGE)
This is great, but what if I need to do some calculation in my summation? So for example:
=SUMIF(CRITERIA_RANGE,CRITERIA,COL1*COL2)
Is something like this possible?
SUMPRODUCT is commonly used in this case
Eg
=SUMPRODUCT((CRITERIA_RANGE=CRITERIA)*COL1*COL2)
A different answer (NOT FOR POINTS).
Explanation
The reason why you cannot use SUMIF in your scenario is because SUMIF cannot handle Arrays as sumproduct does and hence I would go with Chris's suggestion of using SUMPRODUCT
Alternative
Here is one more way to achieve what you want.
=SUM(IF(CRITERIA_RANGE=CRITERIA,COL1*COL2,""))
ScreenShot
Please note that this is an ARRAY FORMULA which means that instead of pressing ENTER, you have to press CTRL+SHIFT+ENTER