So I have normalized some data in Excel to the range of 0-1, using the following formula
(B6-MIN(B$6:B$370))/(MAX(B$6:B$370)-MIN(B$6:B$370))
what I would like to know is how would one go about doing the inverse of the formula above or any other method of reverting back to an de-normalized state.
From what you've posted, the cell B6 is being normalized against the column B. So to de-normalize, it would just be
=B6
If you want to take some arbitrary value between 0 and 1, (e.g., 0.3), you'd just invert the formula algebraically:
= 0.3 * (MAX(B$6:B$370) - MIN(B$6:B$370)) + MIN(B$6:B$370)
To do this with a cell (e.g., D9), it would be the same, just using the cell number instead of a value:
= D9 * (MAX(B$6:B$370) - MIN(B$6:B$370)) + MIN(B$6:B$370)
Related
I am using the MEDIAN function to calculate the overlap of two date ranges.
The formula looks something like this
=MEDIAN(A18,C18+1,$C$8+1)-MEDIAN(A18,C18+1,$B$8)
A18 & C18 are date range 1
B8 & C8 are date range 2
I would like to turn this into an array formula similar to this to sum the results for multiple rows
{=SUM(MEDIAN(A18:A24,C18:C24+1,$C$8+1)-MEDIAN(A18:24,C18:24+1,$B$8))}
This only works if MEDIAN is applied separately to each element in the arrays A18:A24 & C18:C24.
Currently, Excel concatenates the arrays contained within each MEDIAN call and returns the overall median, leaving only one value for SUM to sum. And that is the 'wrong' result for what I need to do.
Is there a way of forcing excel to apply MEDIAN to each element in my arrays? Ie is there a way to force excel to return an array from the MEDIAN function.
If this is possible it allows me to avoid a 120,000 element array or a macro enabled workbook.
Cool MEDIAN formula. But you can't use MEDIAN as you desire with an array formula since MEDIAN always returns a single result (not an array).
I have a solution to your problem, but it's somewhat sluggish/respetitive:
(I have included comments to the right of the formula to explain what is happening)
= IF(C18:C24>C8, // (For each cell in C18:C24) If the value is greater than C8
C8, // Then C8 is the upper bound
C18:C24) // Else, the specific value from C18:C24 is the upper bound
- // (minus sign)
IF(A18:A24<B8, // (For each cell in A18:A24) If the value is less than B8
B8, // Then B8 is the lower bound
A18:A24) // Else, the specific value from A18:A24 is the lower bound
This returns an array of the overlaps of date ranges, except that it is possible that these results will return negative numbers (if an overlap doesn't occur), but in this case you want to return 0.
You can get around this with another IF statement.
= IF(formula < 0, 0, formula)
Where formula is the first formula I have above.
Side note: Normally in this situation, you'd be able to avoid typing out formula twice with something like this:
= MAX(formula,0)
Except this won't work when the formula itself returns an array since MAX only returns a single result. This is a similar problem you are experiencing with MEDIAN in the first place.
All in all without comments, this is the formula to sum up the values:
= SUM(IF((IF(C18:C24>C8,C8,C18:C24)-IF(A18:A24<B8,B8,A18:A24))<0,0,
IF(C18:C24>C8,C8,C18:C24)-IF(A18:A24<B8,B8,A18:A24)))
Of course, this is an array formula, must be entered with Ctrl+Shift+Enter instead of just Enter.
The following sheet shows the data I have. The main idea is to sum up every student's grade, based on a set of weighted criteria.
Cells C9:G11 are populated with data from the list A1:B4, in which every element (Excellent to Poor) is related to a value (10 to 4).
I used the following formula to calculate the value of C12 (and C13 etc.). However, it is too naive. How could this calculation be improved?
=INDEX($B$1:$B$4;MATCH(C9;$A$1:$A$4;0)) + INDEX($B$1:$B$4;MATCH(C10;$A$1:$A$4;0)) + INDEX($B$1:$B$4;MATCH(C11;$A$1:$A$4;0))
UPDATE: I would like to consider the weighted calculation.
=INDEX($B$1:$B$4;MATCH(C9;$A$1:$A$4;0)) * B9 + INDEX($B$1:$B$4;MATCH(C10;$A$1:$A$4;0)) * B10 + INDEX($B$1:$B$4;MATCH(C11;$A$1:$A$4;0)) * B11
Use SUMPRODUCT(SUMIF())
=SUMPRODUCT(SUMIF($A$1:$A$4,C$9:C$11,$B$1:$B$4))
per your update:
=SUMPRODUCT(SUMIF($A$1:$A$4,C$9:C$11,$B$1:$B$4)*$B$9:$B$11)
I have the following columns:
A - Original values, B - Absolute values, C - sorted absolute values
(I obtain the ordered values (C) using the SMALL formula for the given range - see the link bellow)
I need to know for each ordered absolute value, if the original value was or not negative:
So in the picture the red columns I filled-in manually...
Is there a way to automatize that via a formula ?
Here is the link to the sandbox in Excel Online: http://1drv.ms/1Vu2MZ4
If the first link does not work, the same thing and formulas on Google Sheets
A partial answer, which might be enough if column E in your screenshot is what you want and column D was a helper column intended to make column E easy to compute.
The problem with ABS() is that it loses information. Instead of using that, use a function which doesn't lose information but also doesn't change the sort order and which makes it possible to recover the absolute value after sorting. One way is to leave positive numbers alone but send negative numbers to their absolute value + 0.5. For example,
In B2 enter
=IF(A2 >= 0,A2, 0.5+ABS(A2))
In C2 enter
=SMALL($B$2:$B$6,-1+ROW())
In D2 enter
=INT(C2)
To recover the absolute values. Finally, in E2 enter
=IF(C2=D2,FALSE,TRUE)
(copying all of the formulas down).
In your case and for your locale =MATCH(C2; $B$2:$B$6; 0) and = INDEX($A$2:$A$6; MATCH(C2; $B$2:$B$6; 0)) < 0 will do but beware of cases where you have the same value both negative and positive.
I'm a problem with one of my formula in excel. The formula is supposed to return the standard deviation of an range of cells if the value is not judged to be an outlier in another column.
My formula is STDAFV.S(HVIS(R2:R15<>"Outlier";P2:P15;""))
The problem is that it returns a wrong value. In the example below, the formula returns a wrong value of 0.010729, which should be 0.001652.
I'm well aware, that this is a array formula, thus I do press Ctrl+Shift+Enter. So this is not the issue!
Does anyone have a clue for what is wrong?
Col P | Col R
0.0215|
0.0207|
0.0233|
0.0213|
0.0187|
0.0917| Outlier
I get the same result as you when I am computing STDDEV across the 6 values of your OP including 7 empty cells as in your formula (P2:P15)
By doing so I add 7 times a value = 0 to the set which will affect the mean value and the divisor (N-1) in the STDDEV formula.
If I limit the range from row 2 to 7 ... the ones actually containing data, I get the result you're expecting.
Edit:
To circumvent the problem of empty cells without redefinig the range everytime you can make use of =COUNT() and =OFFSET() functions ...
Your values are placed in a growing list, but without empty cells between. So the number of cells (=rows) is the result of a =COUNT(B2:B1000)
Your effective data range now is "from B2 and [count result] cells down" ... i.e. =OFFSET(B2;0;0;COUNT(B2:B1000);1)
Likewise, your effective comment range now is "from C2 and [count result in B] cells down" ... i.e. =OFFSET(C2;0;0;COUNT(B2:B1000);1)
Combining all this ... with data in B2:B15 and remark in C2:C15, the array formula becomes
{ =STDEV.S(IF(OFFSET(C2;0;0;COUNT(B2:B15);1)<>"Outlier";OFFSET(B2;0;0;COUNT(B2:B15);1))) }
ta-taaaa!
I'm trying to get this programmed in Excel:
The variables you can change are Points and Steps. In the table there comes the value for each step until all the points/steps are given. The values beneath that has to be zero. I used the function Numbervalue to check some assumptions, but that didn't workout:
=IF(NUMBERVALUE(Previous_Cell) < POINTS;Previous_Cell+ POINTS_PER_CELL;0)
After the 2 points, the next cell becomes zero. But then the whole list starts over. So there has to be some function that says: If Previous_CELL = 0 then THIS_CELL = 0.
Assuming Points is in A1, in B6:
=IF(OR(SUM(B$5:B5)>B$2,B5=B$2),"",B$3*(MOD(ROW()-1,B$2)+1))
and in C6, with both copied down to suit:
=IF(OR(SUM(C$5:C5)>C$2,C5=C$2),"",C$3*(MOD(ROW()-6,C$2)+1))