Sum numbers in one column - excel

I've a Excel spreadsheet and there's summation and multiplication in my last result a have a big number like this
482362534
and what i want to sum this number for example
4+8+2+3+6+2+5+3+4
and show me the result 37 in another column, is there's a function to do this ?

Try it as,
=SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))

Related

How to calculate an average grade from mix of number grades and letter grades whose values are determined via lookup table

Data Table
Lookup Table
I want to calculate the average grade score of each pupil using an array formula and without the use of helper columns. If all grade are numbers its simple enough to average those, but when letter grades are introduced into the mix I need to convert these to their number values using the lookup table and then average the whole row for each pupil.
So far I was able to take one row and convert all grades that are letters to their corresponding values using the formula below.
=TRANSPOSE(INDIRECT("N"&(MATCH(TRANSPOSE(B2:E2),Table2[Grade],0)+1)))
which returns:
={#N/A,#N/A,7,3}
I then thought, great I got numbers in place of the letter grades, lets just "average" this result like so:
=AVERAGE(TRANSPOSE(INDIRECT("N"&(MATCH(TRANSPOSE(B2:E2),Table2[Grade],0)+1))))
which gives #N/A, which I do not understand when the following is completely allowed:
=AVERAGE({1,2,3})
One way to solve the case is to add all numerical grades to the 2 column Grade table you have in column M and N (technically it is not using helper columns?), then sort the Grade column in ascending order as shown below:
Then you can use the following array formula to find the average grade in cell F2:
=AVERAGE(LOOKUP(B2:E2,Tbl_Grade[Grade],Tbl_Grade[Attainment]))
Being an array formula, you MUST press Ctrl+Shift+Enter upon finishing the formula in the formula bar otherwise it will not function correctly. Then you can simply drag the formula down to apply across.
The logic is to use LOOKUP function to return the corresponding attainment for each given grade regardless if it is an actual number or a letter.
Let me know if you have any questions. Cheers :)
Using VLOOKUPs seems like it would be much simpler:
=AVERAGE(B2,C2,VLOOKUP(D2,$M$2:$N$7,2,FALSE),VLOOKUP(E2,$M$2:$N$7,2,FALSE))
If you can tolerate changing "A*" to say "A+" (or something else that doesn't get interpreted as a wildcard) this may get you going:
=(SUM(B2:E2)+SUMPRODUCT(SUMIF(Table2[Grade],"="&B2:E2,Table2[Attainment])))/COUNTA(B2:E2)
The first SUM sums the numeric grades; the SUMPRODUCT(SUMIF(...)) sums the letter grades. Then divide the total by the number of grades (COUNTA).
Hope that helps

Excel - Formula - Get n values from resulting array of INDEX

With this table named jobSearches:
I am able to calculate the Average of the first row using following formula:
=AVERAGE(INDEX(jobsearches,1,))
Note that INDEX(jobsearches,1,) returns an array of values:
Question:
Is it possible to calculate the AVERAGE for just the first n values of the resolved array, and not for the whole row?
You can do something like this:
=AVERAGE(INDEX(jobsearches,1,2):INDEX(jobsearches,1,11))
Which will return the average of the first 10 numbers on the first row.
That's exactly OFFSET(reference,rows,cols,height,width) function is for:
=AVERAGE(OFFSET(jobsearches,0,1,1,10))

Difference between 2 values in a row in excel formula

How to get this in excel
excel table
F column is the result column
For the following answer I am going to assume you only ever have two numbers in any row, but they can be in any cell along the row and they are always greater than 0.
If you just wish to find the difference between the two numbers without worrying about which number is bigger, a simple equation using maximum and minimum can be used, eg in Cell F1 you would have
=MAX(A1:E1)-MIN(A1:E1)
However, from your example, it seems more likely that you want to know the difference between the first number and the second number.
The difficulty here, is that the cells in columns B, C and D could contain either the first number, the second number, or no number! The solution is to use the following equation in Cell F1
=(MAX(A1:E1)-MIN(A1:E1))*IF(MAX(A1:E1)=INDEX(A1:E1,MATCH(0,A1:E1,-1)),-1,1)
This formula works as follows:
We still start off with the simple difference between the max and min, and then this is multiplied by 1 or -1 depending on which way around the numbers are.
MATCH(0,A1:E1,-1)
This part of the equation looks along the row for a 0, and assumes they are in descending order, so it will return the position of the second number.
This is then inserted into the INDEX function and checked to see if it is the same as the maximum number and the IF function returns either -1 or 1 as required.
Paste this formula on F1, then copy to F2 and F3
=INDEX(A1:E1,MATCH(TRUE,INDEX(A1:E1<>"",),0)) - LOOKUP(9.99E+307,A1:E1)

How can I add or subtract an arbitrary amount from the result of SUM()?

I'm trying to use SUM() in Excel, but I'd like to automatically add 2 to the calculated sum. Likewise, I might want to automatically subtract two, or some other constant number.
I have:
SUM((A1:A12)+2)
.. but this doesn't work. What is the correct formula for this?
You do not add the other value in the SUM function. It is enough to say:
SUM(A1:A12)+2
If you want to add a cell to the sum:
SUM(A1:A12)+B1
If you want to add another SUM I guess you could use something like:
SUM(A1:A12)+SUM(B1:B12)
=(SUM(A1:A12) + 2)
first you find the sum of the values in the cells A1 to A12, and then you add the desired number to the result

combine two functions in Excel

I would like to combine two functions (excel 2013).
I have this function:
=SUM(IF(FREQUENCY(IF(H3:H1002="";IF(C3:C1002="PRODUCT";MATCH(B3:B1002;B3:B1002;0)));ROW(B3:B1002)-ROW(B3)+1);1))
..and want to combine with this function:
=SUMIF(C:C;"OTHER PRODUCT";B:B)
ONLY IF the value in row B3:B1002 is between 1-500 (numerical), otherwise count rows separately and use the first function on top above.
Is this possible?
Given comments below I have completely revised my answer. Try this formula
=SUMIFS(B3:B1000;C3:C1000;"OTHER";B3:B1000;"<=500";H3:H1000;"")+SUM(IF(FREQUENCY(IF(H3:H1000="";IF(C3:C1000="OTHER";IF(B3:B1000>500;MATCH(B3:B1000;B3:B1000;0))));ROW(B3:B1000)-ROW(B3)+1);1))
confirmed with CTRL+SHIFT+ENTER
That will sum any numbers <= 500 in column B, for the specified product and where column H is blank, but also add 1 for every distinct text value or number above 500

Resources