I would like to adjust the setpoint of a thermostat based on variances in hourly power prices. When power prices are lower, I want to adjust the temperature higher. When power prices are higher, I want to adjust the temperature lower.
I think is makes sense to base the size of adjustment based on how far the price is from the average value of the prices. At the same time, I may want to have a fixed range for how large the adjustment may be. For days with a big variation in prices, the whole range could be used. For days with little variation in prices, a smaller range should be used. The adjustments could have a range of [-1.5, -1.0, -0.5, 0.0, +0.5, +1.0, +1.5] as an example. In a day with little variation of prices, maybe only the range [-0.5, 0.0, +0.5] would be used.
How could I map an "unknown" size of variation to a fixed range of adjustment values?
Related
I am trying to create a formula in Excel that solves for the base number of units needed on a monthly interval with an annual growth escalator that matches in whole units the total I'm starting with. I can't from a practical standpoint have fractions.
This is an example of the formula x is number of monthly units, y is the total number of units and the desired annual growth rate is 20%. Here is the algebra butin practice only one variable will need to be solved for (x): y= 12x + (1.2x)*12+(1.2^2)*x*12+(1.2^3)*x*12. I get close using the round function but always end up a few short of the total desired due. Is there a way to add on the difference at the end formulaically?
ROUND(20000/(12+(12*(1+20%))+12*(1+20%)^2+12*(1+20%)^3),0)
I'm extremely close but I need to make sure the total by month matches the total desired.
I have a simple spreadsheet that calculates the mortgage payment (using PMT) once user enters some key fields. I am also calculating the housing ratio (B9) which is the mortgage payment(B6) divided by income (B7). I am comparing the housing ratio to the maximum housing ratio (B8). There are many times when the housing ratio (B9) exceeds the maximum housing ratio (B8) and I need a formula in cell B11 that will tell me by how much I have to reduce the loan amount in (B3) to NOT exceed the maximum housing ratio in B8.
Can someone help me out with the correct formula?
Being that this is a pretty simple calculations, I'd suggest just doing it manually using iterative calculation.
First, enable iterative calculations for your workbook via File > Options > Formulas > "Enable iterative calculations."
Then, edit the formula for the loan amount to be (sale price * LTV) - reduce by
Doesn't take long the enter a few different numbers in for the "reduce by" to find it needs to be reduced by ~$6786.
If you want to make it a little more clear you can add another row under Loan Amount like so:
I am doing a project using accelerometers and have collected large volumes of readings. I need to find acceleration spikes. I used a previous formula I found
=SUMPRODUCT(--(N3:N586>N2:N585),--(N3:N586>N4:N587))
The range of values is N2:N587, how this counts every peak, so even if a sensor reading jumps up and down I get a count. Is there a way to adapt this to count major peaks some like PEAK = cell value is greater than the preceding or following 3,4 or 5 cell values.
as an example
0.01, 0.02, 0.015, 0.018, 0.015, 0.014, 0.016, 0.02, 0.017, 0.018, 0.014,
in this sample I want to count 0.02 as a Major peak, but not the 0.018 as minor peaks.
I can do it if I plot as a graph and manually count, but for some recordings I have over 3000 values I have to expand the graph quite a lot to count them.
any help would be great thanks
You can use VBA and check, if the cell value is greater than a threshold. Yet you don't need VBA, you can use another column and just write an IF-Statement to check, if a threshold is exceeded. If so, return TRUE. Then count all TRUE values using COUNTIF. Or you can directly use COUNTIF and check for thresholds.
For instance:
Using this formula should return the total number of values above 150 in your range: =COUNTIF($N$3:$N$586;">150"). Please note: The cell references are absolute values. The formula returns a total number, not the sum. Adapt the range and the threshold as you need.
You could use an offset formula to check whether the current reading is greater than the previous and next n readings:
=SUM(IFERROR(($A$2:$A$12>SUBTOTAL(4,OFFSET($A$1,ROW($A$2:$A$12)-B2-1,0,B2)))*
($A$2:$A$12>SUBTOTAL(4,OFFSET($A$1,ROW($A$2:$A$12),0,B2))),0))
Has to be entered as an array formula using CtrlShiftEnter
The required offset is stored in B2.
I have tried it with a range of offsets as below:
As you can see, when the offset is increased to 6, you get no peaks because the second peak of 0.02 is equal to the first peak of 0.02. This does highlight a potential snag with this approach, that if you got a genuine peak or plateau with (say) two consecutive values of 0.02, it wouldn't be counted. But if your actual data has several decimal places this probably won't happen.
It's possible for this formula to give a spurious peak at the end of the range because it counts values beyond the range (i.e. A13, A14 etc.) as zeroes - the formula could be further refined to avoid this.
Ive created a game and in that game played 5 users which collected few points, Ive gived gifts manually but for next games how can i split or make in excel to calculate number of gifts,
this is ok using number format with 0 decimal places, 6+1+1+1 = 9
but in cases like this:
1+6+1+1+1 = 10, how can I make that only 9 gifts results?
You should be comparing their percent (B2/SUM(B2:B6)) against each prize as it relates to the total prize (e.g. 1/9). Since you are comparing decimal numbers with another decimal number and expecting an integer (no. of prizes), you will be rounding either up or down depending on whether you are favoring a wider distribution of the prizes or favoring the top score.
Either way you are going to have to decide whether the lowest score should always receive a prize or if the highest score should benefit from the points awarded.
The three possible formulas to start with would be,
=MROUND(C2, 1/9)*9 ◄ closest to even distribution
=FLOOR(C2, 1/9)*9 ◄ favours wider prize distribution
=CEILING(C2, 1/9)*9 ◄ rewards highest awarded points
Fill down as necessary.
Now you have to either take the highest or lowest score and adjust that to compensate for rounding the division of decimal numbers to an integer. MROUND doesn't play well with SUMPRODUCT but these two may give you a solution that you can live with.
=FLOOR($C2, 1/9)*9-((SUMPRODUCT(FLOOR($C$2:$C$6, 1/9)*9)-9)*($C2=MAX($C$2:$C$6)))
=CEILING($C2, 1/9)*9-((SUMPRODUCT(CEILING($C$2:$C$6, 1/9)*9)-9)*($C2=MAX($C$2:$C$6)))
Fill down as necessary.
If the MROUND solution is best suited to your prize distribution model, use a helper column that can determine the MROUND returns and then adjust the high score according to the sum of the helper column without circular references.
This may or may not be the correct forum to post this question to BUT I'm hoping for the best.
Currently, we are trying to calculate what percentile a given salary value is based on the 25th, 50th and 75th percentile for each position in our company. I'm not sure how to go about this given only three data points (25th, 50th and 75th percentiles for each position).
For example, we are paying Employee A $72k/year and the data for this position is: $66k (25th percentile), $72k (50th percentile) and 80k (75th percentile). Clearly, employee A's salary is in the 50th percentile. There are many employees whose salaries do not line up as nicely, so if anyone has an idea how to solve for the percentiles for other salary amounts, I would greatly appreciate it!
I've been trying to create a formula to calculate the percentiles for each salary and have fail miserably so far... Is there a way to do this? Thanks for your time and help!
This is a horiible,horrible kludge, but it gets you some info... Note I haven't taken into account items past 0% and 100%
I put the value I am testing in A1
I put the 25th,50th and 75th percentile in B1,B2 & B3
The formula I used was
=IF(A1<$B$2,0.5+((A1-$B$2)/($B$2-$B$1)/4),0.5+((A1-$B$2)/($B$3-$B$2))/4)
What this does is assume the 25->50 percentile range is the same as the 0% to 25% range, and the 75% to 100% percentile is the same as 50% to 75%.
Without other data like standard deviation, number of samples, and other fun statistics, this is a very bad approximation at best, and no better than rolling dice at worst.