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
Related
I have some columns and i need pr line to add say from O:S and then multiply with corresponding values from column N
So first sum from O:S then multiply with N:N
I could do
=SUMPRODUKT(N:N;O:O) + SUMPRODUKT(N:N;P:P) + SUMPRODUKT(N:N;Q:Q) + SUMPRODUKT(N:N;R:R) + SUMPRODUKT(N:N;S:S)
so I multiply N with each of the columns O to S but im sure there is a better way !
Specialy since it could be from S through QQ and that would be one boring formula to write
=SUMPRODUKT(HVIS.FEJL(N:N*O:Q;0))
' or in English
=SUMPRODUCT(IFERROR(N:N*O:Q,0))
Thank you #VBasic2008 and #mayukh-bhattacharya
SUMPRODUCT: The Multiplier of Arrays
As expected, it's as easy as:
=SUMPRODUCT(N:N*O:S)
Here's a small visual study I 'conducted':
Let's say I have something like this.
I want to sort it to be something like;
is there a function to do this in excel? Like sorting the data base on the x?
You can do that, using a helper column. However, you seem to have two criteria in your question:
Count the amount of x characters. This, you can achieve using a CountIF().
Sort, according to the location of the x character (in case there is only one).
You can achieve the second, using the following system (imagine that, instead of x, there's the number 1):
=G1 * 2^4 + F1 * 2^3 + E1 * 2^2 + D1 * 2^1 + C1 * 2^0
This will create the following numbers for your cases:
8 : Some Text : 1
9 : Some Text : 2
1 : Some Text : 4
...
Combining both calculations gives you what you want.
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!
This is trivial in programming languages, but when I need to do something quick & dirty and to see whether I got the coefficients right, I usually go for Excel.
So, what have I got,
c1(i) c2(i) c3(i)
0,321323232 1 0
0,32132122 0 2
0,321214324 1 2
...
..
.
The polynomial expression is
KT = SUM( AEA0 * c1(i) + J * c2(i) + PD * c3(i) )
i=1,37
One approach would be to make columns with AEA0, J, PD (btw, these are constants) and then multiply & sum them with the coefficient columns. I don't like this one because it adds a lot of extra stuff, and it messes up my copy pasting later (when I copy paste the coefficients to a text file).
Second approach would be to manually form an expression clicking all the cells one by one,
KT = AEA0 cell * A1 + J * B1 + PD * C1 + AEA0 * A2 + J * B2 + PD * C2 + ...
you get the point. Is there a way to improve this approach in some way so it takes a range of A1 to A37?
Is there some better approach to forming this kind of expressions?
Put the value for AEA0 in Z1. Put the value for J in Z2. put the value for PD in Z3.
Then you can use:
=SUM(A1:A37)*Z1+SUM(B1:B37)*Z2+SUM(C1:C37)*Z3
I need to convert a percentage to a scoring system in Excel 2003, either using a built-in formula (preferable) or writing a custom function in VBA. The formula or function must accept a parameter allowing me to specify the maximum score.
For example, let's say there's a function called Pct2Score(Pct As String, MaxScore As Integer) that does just this.
Pct2Score("65%", 4) would return 3 because it would use this distribution:
0%-24.9% = 1
25-49.9% = 2
50-74.9% = 3
75-100% = 4
Pct2Score("65%", 5) would return 4 because it would use this distribution:
0-19.9% = 1
20%-39.9% = 2
40-59.9% = 3
60-79.9% = 4
80-100% = 5
And so on so forth. I'm hoping there is a built-in distribution formula in Excel that does exactly this so that I won't have to rely on VBA. It's even OK to use a combination of formulas to achieve this; the only limitation is that I need everything to be contained in one formula.
A simple formula (descriptive, not Excel) is simply:
1 + INT((Pct AS DOUBLE) * MaxScore / 100).
Using VBA:
Public Function Pct2Score(pct As String, MaxScore As Integer) As Integer
Dim pctD As Double
If (Right(pct, 1) = "%") Then pct = Left(pct, Len(pct) - 1)
pctD = CDbl(pct)
Pct2Score = 1 + Int(pctD * MaxScore / 100)
End Function
With a single formula you can do
=1+INT(A1*B1)
where A1 is Pct and B1 is MaxScore.