Formula for deviation from mean agreement - excel

I have a dataset in Excel and I want to compute a formula for deviation from mean agreement.
Suppose the dataset is like this:
A B C D E
4 2 6 9
1 3 2
7 2 1
8 4 3
5 1 2
What I want to calculate has formula as (summation from i=1 to 5 (i.e., from A to E) |R-R'|/t)/N where N = 4 for 1st row, N = 3 for 2nd row and so on that is, no. of non null values for that row. R is current value in the row and R' is mean of the column for which we are considering R and t is no. of non null values in that vertical or column.

You will need to use the ABS() function to get the absolute value of the subtractions. To get the number of non-null cells you can use the COUNT() function. To only include items in a row that are not null you can use an IF() statement.
For example, if you data was in the range A1:E5 then the following formula would get the result for the first row if I've understood the calculation you are doing correctly:
=(IF(LEN(A1)>0,(ABS(A1-SUM(A$1:A$5))/COUNT(A$1:A$5)))+IF(LEN(B1)>0,(ABS(B1-SUM(B$1:B$5))/COUNT(B$1:B$5)))+IF(LEN(C1)>0,(ABS(C1-SUM(C$1:C$5))/COUNT(C$1:C$5)))+IF(LEN(D1)>0,(ABS(D1-SUM(D$1:D$5))/COUNT(D$1:D$5)))+IF(LEN(E1)>0,(ABS(E1-SUM(E$1:E$5))/COUNT(E$1:E$5))))/COUNT($A1:$E1)
Which results in 2.4853 for row 1

Related

How to get weighted sum depending on multipliers in column in Excel?

I have the table in Excel:
In column C (Sum) I want to get sum this way:
If in column A or B value is 1 then take Amount 48 and multiply by Multiplier (1) = 2.
If in column A or B value is 0 then take Amount 48 and multiply by Multiplier (0) = 1,5.
Then K1 and K2 summed.
So for row 2 the result in column C will be: 48*2 + 48*2 = 192.
For row 5 the result in column C will be: 48*1,5 + 48*2 = 168.
Is it possible to automate this process using Excel formula for C column (inspite of number of columns)?
Or you could use Countif (no shorter though)
=COUNTIF(A2:D2,0)*I$2*I$1+COUNTIF(A2:D2,1)*I$3*I$1
Use Ctrl+Alt+Enter when entering (since it's an array formula)
EDIT: I'm not great with formulas, so there is I'm sure a shorter alernative...

Look up for highest value from another column if values are equal excel

***1 2 3***
a 2 3
b 3 4
c 4 3
d 5 2
so I know to get the highest value I do
=INDEX(column1, MATCH(MAX(column3), column3, 0))
... which would give me 'b'
now I want to get the second highest value based on the column 3 but because there are two cells with 3 (which is the second highest value) I want to use the one that has the lowest value in column 2 based on those two rows. Is this possible?
Use a 'helper' column that adds column C + (column B ÷ 10) and use a modification of your original formula on that column.
        
The standard formula in F5 is,
=INDEX(A$2:A$5, MATCH(AGGREGATE(14, 6, D$2:D$5, ROW(1:1)), D$2:D$5, 0))
Fill down as necessary.

Find maximum of row, return column name

I have four rows and six columns of random numbers between 1 and 10. The headers atop are named A through F accordingly. I want to populate a range (A1:A6) on another sheet with the maximum number for each row. That is easy with the MAX function. However, in a another range (B1:B6), I want to put the column name to which this number belongs.
An HLOOKUP() won't work because a maximum value in one row is likely not unique number across the entire sheet. I am thinking a MATCH INDEX type function, but my understanding of those functions, especially in conjunction, is poor.
A B C D E F
1 0 2 10 9 8
9 3 7 6 9 10
10 3 0 2 1 4
9 4 7 8 6 3
Assuming your array is in Sheet1 and the columns are labelled, please try in another sheet, copied down to suit (to Row4 since there are only four rows of numbers in your data):
=INDEX(Sheet1!A$1:F$1,MATCH(MAX(Sheet1!A2:F2),Sheet1!A2:F2,0))
This will return only the first column label from a row where the maximum for that row occurs more than once.

Give column number of first column with symbol

So say I have a sheet like the following:
Row 1 2 3 4 5 6
1 x
2 x
3 x x
4 x
5 x x
6 x
And I have another sheet which I want to encapsulate the data with:
1st appeared
1
2
1
4
2
6
I'm basically trying to construct the second sheet. Is there a way for each row to start at column two and go up to the ith column and display where the first 'x' appears. (Note that we can assume that every row will have at least 1 'x' when the row and column meet forming a diagonal down the entire first sheet) [Note that my first spreadsheet is roughly 5,000 x 5,000 hence why I'd like a nice formula for this instead of doing things by hand =)]
Thanks in advance!
The MATCH function return the relative position in either a row or column. Use this formula in your second worksheet.
=iferror(match("x", sheet1!1:1, 0) - 1, 0)
Fill down to retrieve the correct column index or zero if not found. A 1 is subtracted since hte want the position relative to column B. The IFERROR function return a default 0 is no match is found. Substitute "" in place of the zero if you want nothing displayed.

How to use index match with IF in excel?

Table1
A B C D
1 Seq Item Re-Order Qty On-hand Qty
2 1 X 10 15
3 2 Y 10 5
4 3 Z 10 10
Other worksheet:
Table2
Expected output:
A B C
1 Seq Item Re-Order Qty
2 1 N/A N/A
3 2 Y 10
4 3 N/A N/A
In table2 I need to put in column 2 equation like this:
Index(Table1[Item],Match(table2[Seq],tabel1[Seq],0) WHERE table1[reorder qty] > table1[On-hand Qty]
I'm not sure how such requirement could be managed?
This can be done. It requires the use of an array formula in Table2.
Normally with an INDEX you simply use a range of cells as the array (first argument of the formula). In this case, we will give it a new array to return based on the results of a conditional (your WHERE clause).
I will start with the picture of results and then give the formulas. For me, Table1 is on the left, Table2 on the right.
Formulas
The formulas are very similar, the main difference is which column to return in the IF part which generates the array for INDEX. The conditional part of the IF is the same for all columns. Note that using Tables here really helps copying around the formulas since the ranges cannot change under us.
These are all array formulas and need to be entered with CTRL+SHIFT+ENTER.
Table2[Item]
=INDEX(IF(Table1[Re-Order Qty]>Table1[On-hand Qty],Table1[Item],"N/A"), MATCH([#Seq],Table1[Seq],0))
Table2[Re-Order Qty]
=INDEX(IF(Table1[Re-Order Qty]>Table1[On-hand Qty],Table1[Re-Order Qty],"N/A"), MATCH([#Seq],Table1[Seq],0))
Table2[On-hand Qty]
=INDEX(IF(Table1[Re-Order Qty]>Table1[On-hand Qty],Table1[On-hand Qty],"N/A"), MATCH([#Seq],Table1[Seq],0))
The main idea behind these formulas is:
Return a new array based on the conditional. This new array will return the desired column (Item, Re-order, ...) or it will return N/A if the conditional is FALSE. This requires the array formula entry since it is going row by row in the IF.
The MATCH part of the formula to get the row number is "standard". We are simply looking for the Seq number in Table1. This determines which row of the new array to return.

Resources