Multiply row with above row and obtain an average - excel

I have an excel table with lets say 500 columns and 2 rows. I want to multiply each cell in the second row with the cell above, in the first row. Then get the average of the sum.
Example:
3 4 1 2 5
1 3 3 5 1
Solution would be: (3*1 + 4*3 + 1*3 + 2*5 + 5*1) / number of columns
What would the command look like in Excel?

For data in rows 1 and 2 use
=SUMPRODUCT(1:1,2:2)/COUNT(1:1)

Here's what I'd do:
1) In the third row first column enter "=A1+A2". Copy/paste that across the entire row to propagate.
2) In another column somewhere enter "AVERAGE(C1:C500)".
That cell in #2 should give you the answer.

Related

Excel - sum if name is subset of another

Say I have a table like this in Excel (except the third and last column, which is what I want to obtain)
Name
Value
What I want
X
1
1
X-Y
1
2
X-Y-Z
0
2
X-V
1
2
So in column 3 I want to do a sumif which sums the column "Value" across all rows where Name is a subset of the given name in the row being looked at.
E.g. for row 2 the returned value will be 2 - because both X and X-Y is a subset of X-Y - so it sums these two rows' values.
How can I do this in a formula?
Found the solution myself.
In C2 put
=SUMPRODUCT($B$2:$B$5; --(IFERROR(IF(FIND($A$2:$A$5;A2)>0;1;0);0)=1))

Excel Average every 4 numbers

In excel, I have a column of about 30,000 entries. I want to take that column and create a new one where the first entry will be the average of the first 4 entries in the original column. The 2 entry in the new column will be the average of the next 4 entries of the original column (from 5-8), so on and so forth. The new column then will therefore have 1/4 of the the size of the original column. How can you do this with excel?
In the image you see the N column from where I want to calculate the averages. In the Q column you see the average of the first 4 values of the N column. I want to extend the Q column so the second entry would be the average of the next 4 values (from 5th to 8th values) and so on and so forth for the remainder of the N column. As said, the Q column will therefore have at the end 1/4 of the size of the N column.
Try below formula.
=SUM(INDIRECT("N" & ROW()*4-3 & ":N" & ROW()*4))/4
ROW()*4 this will multiply every row by 4 means will create a series like 4, 8, 12 ... Now ROW()*4-3 will generate 1, 5, 9 ...
So, by this part of formula "N" & ROW()*4-3 & ":N" & ROW()*4 we will get N1:N4, N5:N8, N9:N12 and so on. INDIRECT() formula will redirect those ranges for SUM() formula and SUM formula will give you summation of of every 4 row data. Finally dividing by 4 will give you average.
#harun24hr has probably posted the right answer, but an alternative solution could be to do the following:
Merge 4 cells in the column you wnat to show the average and then calculate the average eg:
=AVERAGE(A1:A4)

EXCEL: Take the average of a column in row (n-5,n-1) if row n fulfills a condition

There are 50 rows. The first column (A), each row has has a ID number. They are not sorted in any way and should not be either and there are no duplicated ID numbers. When the ID is 0 then consider 4 rows before that row, take the mean value of those values in clumn C between those 4 rows. If it helps It is always the last row that has value ID = 0.
What I have done so far is that I can find the ROW number of the ID = 0 using the following formula:
ROW(INDEX(A3:A53,MATCH(TRUE,INDEX(A3:A53=0,),0)))
Now I don't know how to navigate 4 rows upwards and take the corrosponding values in Column C.
If you use an extra column (say column Z), then paste this code into that column starting on row 4 (NB it won't work properly for the first 3 rows because there are not 4 above to check).
=IF($A4 =0, AVERAGE($C1:$C4), "Not Relevant")
so put that code in Z4, then press ctrl+E to flash fill it downwards.
Hopefully, on each line where the ID is 0, there will be an average of that line and the previous 3 in column Z on that row.
Use:
=AVERAGE(INDEX(A3:A53,MATCH(TRUE,INDEX(A3:A53=0,),0)-5):INDEX(A3:A53,MATCH(TRUE,INDEX(A3:A53=0,),0)-1))

Dynamically change row number in excel

I got a file in excel that often changes the row number (My first column) whenever there is a insertion of data. However, there is multiple rows of data with the same row number.
Example:
1
1
2
3
3
3
Is there a way I can change them dynamically beside grouping the number together via Filter and change it manually?
Edited.
1
1
1
2
3
4
4
4
Better example. Sorry about the indentation.
I can propose a partial solution.
Set the value only in the first identical value and change only those unique values when a group of rows is inserted:
1 1
1 =A1
1 =A2
2 2
3 3
4 4
4 =A6
4 =A7
Otherwise, you do it from VBA to change all values when a new row is inserted.

Microsoft Excel 2010: Help making a Formula to up Values by a repeating pattern

I have a Spreadsheet, and inside this sheet contains a column with numbers, I want to make a formula that will go down that Column and do basically this.. Values: 1 will be 9.50. 2 will be 9.75. 3 will be 10.00. Ect going up to Value of 100? Is that possible for a Formula? I keep playing with it but can't really seem to get it down. Any help would be appreciated.
Column A: 1
1
1
1
1
2
2
2
2
2
2
2
2
2
3
3
3
3
There is not a set amount to how many values are in there.
this should do it supposing that column A has these values 1, 2 ...etc that your computing will be based on
=MIN(9.25+A1*0.25;100)*COUNT(A1)
In A2, enter the formula
=A1 + (9.5-A1)
then in the cell just below it (A3), enter
=A2+0.25
Assuming A1 is the top left. Copy the formula in A3, select the next 399 cells and paste. Then select A2 - A364 and copy. Then select B2 -xx364 and paste. xx is the last column with data. If you want, set the height of your first column to 0 to hide it.
=(A1-1)*0.25+9.5 where A1 contains any number you want

Resources