How to sum a function in excel? - excel-formula

I want to sum this function up:
=I3*(A3*0.014+0.25)+I4*(A4*0.014+0.25)+I5*(A5*0.014+0.25)+....
But I don't know which function to use to sum everything to one. That doesn't work unfortunately
=SUM(I3:I9)*(SUM(A3:A9)*0.014+0.25)

Use SUMPRODUCT:
=SUMPRODUCT(I3:I9 * (A3:A9 * 0.014 + 0.25))

Related

Raising a number to the power of a range of numbers

The formula I would like to use looks something like this: SUMPRODUCT(x^(1:n),y^(n:1)). n=values in column A. 1:n is the exponents in forward progression from 1 to n in steps of 1. n:1 is the exponents in reverse progression from n to 1 in steps of 1. I would like the formula to be dynamic to fill in column B with the n values based on column A.
Try:
=SUMPRODUCT(5^ROW(1:100))
Or in Excel O365
=SUM(5^ROW(1:100))
As per #RonRosenfeld, a more sturdy solution could be =SUM(5^SEQUENCE(100)) in Excel 365.
EDIT: Based on OP's comments he could use (no O365):
=SUMPRODUCT(5^ROW(A1:INDEX(A:A,COUNTA(A:A))),7^LARGE(ROW(A1:INDEX(A:A,COUNTA(A:A))),ROW(A1:INDEX(A:A,COUNTA(A:A)))))
You can store the powers in a column and use the array formula:
SUM((A1:A100)^$B$1) where A column contains 5 in each cell and B column contains the range of powers you want to use. You can use an array formula in the different cell to get the answer.
Use the SERIESSUM function
The Excel SERIESSUM function returns the sum of a power series, based on the following power series expansion:
Power Series Equation
The syntax of the function is:
SERIESSUM( x, n, m, coefficients )
Where the function arguments are:
x - The input value to the power series.
n - The first power to which x is to be raised.
m - The step size that n is increased by, on each successive power of x.
coefficients - An array of coefficients that multiply each successive power of x.
The number of values in the supplied coefficients array defines the number of terms in the power series. This is illustrated in the following examples.
Example 1:
In the spreadsheet below, the Excel Seriessum function is used to calculate the power series:
5^1 + 5^2 + 5^3 + 5^4 + 5^5
formula: =SERIESSUM( 5, 1, 1, {1,1,1,1,1} )
output = 3905
Example 2:
1 * 2^1 + 2 * 2^3 + 3 * 2^5 + 4 * 2^7 + 5 * 2^9
formula: =SERIESSUM( 2, 1, 2, {1,2,3,4,5} )
output = 3186
I hope this is of help.
An Alternative Answer again. I think the correct for your case :-)
Using the SERIESSUM function allows the use of different coefficients therefore the reason for the use of the coefficients in an array. But because the coefficients are the same then this is simply a geometric progression.
The following formula will do that for you:
=n+n*(n)^(1)*(1-(n)^c)/(1-n)
where "n" is the number (5) and "c" is the number of the series (100)
This becomes:
=5+5*(5)^(1)*(1-(5)^100)/(1-5)
=SUMPRODUCT(5^ROW(A1:INDEX(A:A,COUNTA(A:A))),7^LARGE(ROW(A1:INDEX(A:A,COUNTA(A:A))),ROW(A1:INDEX(A:A,COUNTA(A:A)))))
This formula worked flawlessly!!!
Thank you #JvdV and everyone else for your efforts in helping me! GREATLY APPRECIATED!

How can I round up a number in cell to specific number in Excel

I have some product prices like
30,56
25,34
26,88
30,13
I want to to round them with a 0,50 limit
if the number is over x.50 to make it x.90 and if not make it x.50
is it possible with a function of VBA?
Alternate solution:
=INT(A1)+0.5+0.4*(MOD(A1,1)>0.5)
Use this formula to round:
=IF(A:A-INT(A:A)>0.5,INT(A:A)+0.9,INT(A:A)+0.5)
Explanation
It subtracts the integer part of the floating number so and tests if this is >0.5 so A:A-INT(A:A)>0.5 means (30.56 - 30) > 0.5 which is0.56 > 0.5
The formula means something like that:
If (30.56 - 30) > 0.5 Then (30 + 0.9) Else (30 + 0.5)
Use IF, MOD and RoundDown
=IF(MOD(A2,1)>0.5,ROUNDDOWN(A2,0)+0.9,ROUNDDOWN(A2,0)+0.5)
You may want additional conditions to handle fringe cases like a price of 0.

How do I get offset function working with max function?

Many thanks for taking the time to read this.
I've got a function to return the closest value that is less than a given value:
=MAX(IF(O80:O85<Y80,O80:O85))
This works well and I now want to multiply it by the value on the right of the value that was found so I am trying to use the offset function:
=MAX(IF(O80:O85<Y80,O80:O85))*(1+OFFSET(MAX(IF(O80:O85<Y80,O80:O85)),0,1))
But this isn't working. I've done a similar thing with another function and the offset works perfectly Does anybody know why it's not the case here?
I am using Ctrl + Shift + Enter
Many thanks
The offset function first needs a reference, but the max function just gives a value.
This would be a solution based on your first function
=(MAX(if(O80:O85<Y80,O80:O85)),O80:O85,0))* (1+INDEX(P80:P85,MATCH(MAX(if(O80:O85<Y80,O80:O85)),O80:O85,0)))
ARRAY Formula: CTRL + SHIFT + ENTER
IMO, the best pseudo-MAXIFS if you don't have Office 365 with the new MAXIFS is AGGREGATE as a standard non-array formula.
=aggregate(14, 7, O80:O85/(O80:O85<Y80), 1)
Multiply that result against the matching value in P80:P85.
=aggregate(14, 7, O80:O85/(O80:O85<Y80), 1)*index(P80:P85, match(aggregate(14, 7, O80:O85/(O80:O85<Y80), 1), O80:O85, 0))
You can use INDEX-MATCH to make easily what you need:
=INDEX(where-is-your-data,MATCH(what-is-the-target,where-is-your-data,Less-than-option))
In your case:
=INDEX(O80:O85,MATCH(Y80,O80:O85,1))
It's important to class your data in ascending order because the formula will give the closest value by checking your data one after one and stop without checking further the closest.
For the second part, if you need to multiply by an offset to the value on the right of the selected value, just make this:
=INDEX(O80:O85,MATCH(Y80,O80:O85,1))*OFFSET(INDEX(O80:O85,MATCH(Y80,O80:O85,1)),0,1)

Portfolio optimization and MMULT for matrix multiplication not giving me the correct answer

I have two vectors in Excel that I want to perform matrix multiclication:
I want to calculate the portfolio return, which should be (30% * 3%) + (20% * 2%) + (50% * 1%) = 1.8%
I performed MMULT(TRANSPOSE(A2:C2),A5:C5), and it gives me 0.60%. Am I doing something wrong????
I think you need SUMPRODUCT, not MMULT.
=SUMPRODUCT(A2:C2, A4:C4)
I agree with #Jeeped's answer that SUMPRODUCT is better to use here.
Just giving a bit more information:
MMULT(TRANSPOSE(A2:C2),A5:C5) mathematically performs the following:
[0.3] [0.009 0.006 0.003]
[0.2] * [0.03 0.02 0.01] = [0.006 0.004 0.002]
[0.5] [0.015 0.010 0.005]
Typically, if a formula returns an array, the value in the upper-left most column only is displayed in the cell. (In this case, it would be 0.9% since 0.009 is formatted as a percentage).
However, in this case, 0.9% would only be returned if the formula is entered as an array formula (press Ctrl+Shift+Enter rather than just Enter). I've found that TRANSPOSE acts very strange when it is part of a non-array formula, which explains you seeing the incorrect result of 0.6%.
Of course, this matrix result isn't even what you want anyway, since you only want a single result. You actually need the TRANSPOSE to be in the second argument of MMULT rather than the first argument.
MMULT(A2:C2,TRANSPOSE(A5:C5)) mathematically performs the following:
[0.03]
[0.3 0.2 0.5] * [0.02] = [0.018]
[0.01]
And this is what you want.
Again, in order to actually get this result, you must enter MMULT(A2:C2,TRANSPOSE(A5:C5)) as an array formula.

Concurrent sum

Can I sum these numbers with a formula ?
1
2
3
4
5
6
No, Im not looking for ="Sum(Cell___1:Cell_6)".
With "Product" you multiply - I just want to add them.
Like "=1+2+3+4+5+6", but just with a formula. Eg "formulaName(6)".
You mean:
Sum = n * (n+1) / 2, where n is the last number in the sequence?
Well... =6*(6+1)/2 ought to do it
For a more general approach, you could put 6 into, say, A1, and use
=A1*(A1+1)/2
Function GaussForm(ByVal x As Integer) As Integer
GaussForm = (x * (x + 1) / 2)
End Function
Not very Gaussian, but here's another way:
=SUM(ROW(A1:A6))
It's an array formula, so enter with Control+Shift+Enter

Resources