Formula for summing up progressive column values - excel-formula

I have a formula that calculates certain value using column values.
=Sheet2!B3*Sheet2!B2/SUM(Play!B3:B10)
Now where I am struggling is I want to do apply the same formula for all columns from B to Z and then sum them up in to a single value.
Something like
=SUM((Sheet2!B3 * Sheet2!B2/SUM(Play!B3:B10)), Sheet2!C3 * Sheet2!C2/SUM(Play!C3:C10)),.....)

The SUMPRODUCT formula takes arrays of numbers and multiplies the numbers at each index together, then sums up the products.
The first two references are simple, but the third required more thought. (h/t to this question).
=SUMPRODUCT(Sheet2!B3:Z3,Sheet2!B2:Z2,1/TRANSPOSE(MMULT(TRANSPOSE(Play!B3:Z10),IF(Play!B3:B10,1,1))))
Note: This is an Array formula, so after you paste it in, you must press Ctrl + Shift + Enter, and not just Enter. It can easily be adapted to grow/shrink according to your needs.

Related

Sum and subtract among column and row cells in excel

I have an excel document where I have some amount in number in different cells. For example, I have number in column H,I,J of row 1.
How can I sum H+I and then subtract J from the result of H+I?
Thanks
Hi and welcome to Stack Overflow.
Let's say you have your original value in cell H1, the value to add in cell I1, and the value to subtract from their sum in cell J1.
The formula would be:
=H1+I1-J1
Notes:
Since addition and subtraction are related functions, there is no need to add parentheses to enforce proper order of operations.
Addition operator and subtraction operator signs work, no need for explicit Excel functions. There is no subtract function in Excel (perhaps where your confusion comes from), so if you wanted to use explicit functions you would write
=SUM(H1,I1,J1*-1)
If you're trying to sum over a larger range (entire columns of I and J, for example), let me know and I'll adapt my response.
If you want to add two columns say H1+I1 and subtract J1 from the result(H1+I1) and store the final result into column K1, then first select the K1 column and in the formula section type =H1+I1-J1. In the picture below, I am adding value of A1 and B1. After that subtracting the value of C1 from A1+B1. So, for the cell D1 to show the result of A1+B1-C1, select D1 and write the formula as it is showing in the picture.

Excel: Apply formula to each cell in column within another formula

I have a column of numbers. I want to ROUND the numbers in each cell of the column and then take the SUM of the cells.
Of course this can be done by creating another column with the rounded values and then taking its sum.
Say that I have 10 cells in column A. I round them to the nearest 0 using ROUND(A#,0) for A1 through A10. These new values go in B#. Then in B11 I have SUM(B1:B10).
Is there a way to apply the ROUND forumla to each cell in column A within the SUM function so that I do not need to create another column of values?
SUMPRODUCT 'Deals' in Arrays 2
=SUMPRODUCT(ROUND(A1:A10,0))
Just use an array formula - enter with Ctrl + Shift + Enter.
=SUM(ROUND(A1:A10,0))
For example (also shows the rounded numbers in Column B to show it works, or you can see the magic with Formulas > Evaluate Formula.)

Formula for comparing multiple cells with random values in excel and return conditional output

I need a formula to perform below operation in MS excel. Here is the scenario:
My case is I have to compare 4 cells in a single row. 3 of the cell values are similar and 1 will be unique always. They can be in random sequence but there will be an unique value and 3 duplicate values while comparing 4 cells. As you can see in the result column, I need the output which is the unique value. Please help me to write the formula.
If your cells contain only numbers, here's an approach using SUMIF and MODE.SINGL
=SUMIF(A2:D2,"<>"&MODE.SNGL(A2:D2))
For text or numbers, you can use an array formula - enter with Ctrl + Shift + Enter.
=INDEX(A2:D2,MATCH(MIN(COUNTIF(A2:D2,A2:D2)),COUNTIF(A2:D2,A2:D2),0))

How to do excel formula that would Sum values from column C if column A is 'X' or 'Y' and column B is 'Z'?

I have a spreadsheet from which I need to pick out some specific values that are in one of text columns but only if other column matches the year.
I have tried following SUM with IF but I think OR portion in textual column is failing...
=SUM(IF(B:B="*Nuoma*",B:B="*(Nuomininko)*",C:C=2016,D:D))
What I need is if in column B value contains Nuoma OR (Nuomininko) AND column C is 2016 then SUM column D...
Try,
=SUM(SUMIFS(D:D, B:B, {"*Nuoma*","*(Nuomininko)*"}, C:C, 2016))
The {"*Nuoma*","*(Nuomininko)*"} provides the OR to a wildcard match on Nuoma or a wildcard match containing (Nuomininko). You must wrap the SUMIFS in a SUM but no CSE is required.
Here's a suggestion based on the fact that in your example, both strings 'Nuoma' and 'Nuominiko' contain the same string 'Nuom'. It uses SUMPRODUCT and SEARCH (as a substitute for wildcards) together with a help column for the string matching.
Cell D7 in the screenshot contains this formula:
=IFERROR(SEARCH("Nuom",B7),0)
And the summation in E15 is done by =SUMPRODUCT(E6:E13,--(C6:C13=2016),--(D6:D13=1)). In my example this evaluates to the sum of cells E10 and E14: 4 + 2 = 6.
If you prefer to avoid the help column and use an array formula instead, this one produces the same result without involving column D (don't forget to do Ctrl + Shift + Enter):
{=SUMPRODUCT(E7:E14,--(C7:C14=2016),IFERROR(SEARCH("Nuom",B7:B14),0))}
I suppose it would be relatively straightforward to extended this to more complicated situations.

The max of all possible sequential sums

Is there a way to write this using formulas.
=Max(a, a+b, a+b+c, a+b+c+d, a+b+c+d+e+...)
I don't want to use VBA for this task and I am not sure how to approach this problem.
Excel sheet expanded with formula
Excel sheet contracted without formula
Objectives:
1) For each of the peoples, (Bill, Ben, Katy), I would like to compare the maximum of the sum of only X through time.
For example, in Column J, I would like to know the current Max of the sum of X. Current is the date 1/17/19 because it is the most recent entry.
2) For each of the peoples, (Bill,Ben, Katy), I would like to compare the max of the previous entry to the max of my most recent entry.
For example, in Column K, I would like to compare the Max of the sum of X at 1/5/16 to the max of the sum of X at 1/17/16.
3) I would like Column J and K to recalculate as I bring in new data entries into Column I. As of now, using a solution mentioned below, in Column J, I think I would be using something like this formula:
=MAX(MMULT(0+(ROW(B9:I9)>=TRANSPOSE(ROW(B9:I9))),B9:I9)
This solution seems to work if I only have X's going down vertically though.
Also, as new data gets brought in, Column J and K would be pushed to the right, becoming Column K and L.
4) The highlighted region in Column I and J are my output sections that are dependent on the date of Cell B1.
For example, if I were to change the date to 1/1/2016 in Cell B1, Cell I7 would equal -4 Cell J7 would equal True.
If I were to change the date to 1/17/16 in Cell B1, Cell I7 would equal 5 and Cell J7 would equal True.
I've been playing around with this a bit, trying to use SUMIFS to pick up sum of X based on a date criteria.
I thank everyone in advance for all your help, and I apologize if my wording to this problem is unclear. I am a undergraduate student, and have no background in computer/programming/anything of that sort at all. Thank you so much!
Assuming a, b, c etc are in a column, then a standard approach will be to use an additional column with a cumulative sum of the values in the input column. Then you can just take the MAX of the column with the cumulative sum.
E.g. use of cumulative sum in column B with the input values in column A:
With MAX formula in column C:
Assuming data in A1:A5, you can use this array formula**:
=MAX(MMULT(0+(ROW(A1:A5)>=TRANSPOSE(ROW(A1:A5))),A1:A5))
which, due to its being non-volatile, is preferable to:
=MAX(SUBTOTAL(9,OFFSET(A1:A5,,,ROW(A1:A5)-MIN(ROW(A1:A5))+1)))
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

Resources