Optimize SUMIFS formula [closed] - arrays
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I basically have a super long formula that I need to shrink. So basically I have a pivot table that allows a manager to select two work locations or both and one to twelve months.
This is how the formula looks. Only thing that changes are cell I and J->K. Would I need to set this up in a array?
=SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$3,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$4,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$5,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$6,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$7,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$8,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$9,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$10,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$11,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$12,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$13,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$14,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$3,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$4,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$5,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$6,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$7,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$8,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$9,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$10,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$11,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$12,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$13,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)+SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$14,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$K$2)
This formula should give the same result
=SUMPRODUCT(SUMIFS('owssvr(1)'!C:C,'owssvr(1)'!$IR:$IR,$I$3:$I$14,'owssvr(1)'!$IQ:$IQ,'Summary KPI'!$J$2:$K$2))
Assuming you want to sum for all combinations then you can have at most one vertical and one horizontal range as criteria in SUMIFS (so $I$3:$I$14 and 'Summary KPI'!$J$2:$K$2 qualify as those).
SUMIFS then returns an array of 12x2 values (the same dimensions as your criteria) and SUMPRODUCT sums all those to get the correct result (used instead of SUM so that "array entry" is not required)
Related
How to sort an array in a way that if a condition is met the contents get sorted first? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month. Improve this question I need to sort an array of orders so that the ones already on delivery get put at the end of the list so to put the unfinished orders on the top. The variable state is what i wanted to sort on. If the variable is 0 the contents should have a higher priority than where the state is 1. Here is a simplification of what i need: input array: {{state=1,...},{state=0,...},{state=0,...},{state=0,...},{state=1,...}} => output array: {{state=0,...},{state=0,...},{state=0,...},{state=1,...},{state=1,...}} I tried table.sort and some other methods but it didn't fit what i needed or didn't do what i wanted it to do.
table.sort(arr, function(a, b) return a.state < b.state end) works fine to sort arr in non-descending order based on the state field of each entry. How did you try to use table.sort?
Sumif (google sheets) but data is every nth cell in a column, every nth column based on cell n-4 [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 4 months ago. Improve this question Im trying to make a budget tracker Is there a way i can sum every nth cell in a column if the n-4 is a specific string? I found this but not sure how i can add a "=person A" to the criteria. Is there a better way to format this data ?
try in C2 and drag to the right: =INDEX(BYROW(REGEXREPLACE($A2:$A3, "(?i)total ", ), LAMBDA(T, SUM(IFNA(FILTER(C7:C15, C4:C12=T)))))) ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Find row in 2 columns where IF AND is meet between these 2 cells in respective row [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I need a function that will check if column C has a cell with "2/1/2020" date and also column D has a cell with a specific word, let's say "Savinjska" (in my case) in the same row. And return the rows where these combinations in both columns are meet. Further, these found rows are needed to collect 2 numbers from the E and F column and divide them (F/E). I hope it is clear. I don't have much experience with Match, Index or Row functions... You can check my spreadsheet here: https://docs.google.com/spreadsheets/d/1N_quzKffRB5iDT1b2qZ0VCEycq5vYJ7uY48HXz5n6P4/edit?usp=sharing
use in row 2: =ARRAYFORMULA(IF((C2:C=DATE(2020, 2, 1))*(D2:D="Savinjska"), F2:F/E2:E, ))
Enter the formula in a cell in row 2: =if(and(C2=DATE(2020,2,1),D2="Savinjska"),F2/E2,"") and: this enables two logical expressions to be evaluated C2=DATE(2020,2,1): this compares the date in Cell C2 to the desired date D2="Savinjska": Compares the value in cell D2 to the desired name if the formularmula evaluates as TRUE, the it returns F2/E2
C How can I calculate an average of a list without loops? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question So I created a linked List in C using structs and it stores ints. My mission is to calculate the average of the values in the list without using recursion or loops. I already have the list's item count I just need the sum. Any ideas?
Simply have two varibles - count, total; Update them in Add and Delete. When u want avg, just return total/count.
The list is not length bounded, but i found a solution. I create a variable in the list's ateuct to save the sum of the list, and i change the sum of the list each time I add or remove a cell. When I want to calculate the sums I'll just divide the sum by the count. Thank you anyway for your help :)
VBA Merging two or more totals based on user input, then delete the originals [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 years ago. Improve this question Hello Im very new to VBA and am currently working with this issue, im trying to merge two or more totals based on user input as to the company name, example of the list: 2nd Cup 1937168 A & W 6485425 Applebee's 1550895 Arby's 8382549 Archie Burger 86776 The user needs to input the names of the companies they want to merge and this will create a new company with the total sum of the combinations, finally deleting the entries off the original list. I currently am looking into an array for this but am not sure how it would work. Any help would be vastly appreciated!
For a user-friendly approach, you can use a userform with an associated mult-select, multi-column listbox (for the original data) and a textbox (for the new company name) and then write the code to process your data. A good tutorial to get you started, from one of our SO experts, can be found here