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.
Related
I have a column with increasing numbers and I want with forecast.linear to predict the missing values between the previous values and the next value. G2:G6 AND G16.
However when I run the FORECAST.LINEAR(F14,G2:G13,F2:F13) it outputs 1.60 which is not correct if you consider that it should be something greater than 1.62 and less than 1.89
UPDATE:
I did this calculation and it seems ok
=IF(AND(G2=0;G3=0;G4<>0;G1<>0)=TRUE;ROUND((G4-G1)/3;2);FALSE)
The correct linear progression for the values your sample shows for 4/1/21 through 15/1/21 should be 1.60424. The final value, 1.62, happens to be a high outlier that is above the linear best fit for the values given. So the function is working correctly. It would not be uncommon for the first or last points to be above or below the linear progression.
The problem is that the function’s range of known Y values ends with 1.62, so the function you entered knows nothing of the 1.89 value.
When I set the problem up to skip a 13th and 14th x and y, but include a 15th value 1.89, I get 1.61 and 1.74 for values 13 and 14, so even when including the 1.89 value, the 13th value is still less than 1.62. It’s a significantly high variation from the linear.
I’m not sure what the best approach is, but this will not likely be an easy problem to solve using this approach. You end up with a circular reference if the Y value you are trying to forecast is within the known Y values range of the formula. The normal way of solving this problem is to have separate actual columns and forecast columns, and not mix the two
This is a little bit complicated to describe, but I will try my best. I have a total, let's say 1000. Then I want to split it by percentages, position count is all the time different. So there can be 3 or 70 or 130 positions or whatever. Then split sum should correspond to target value.
Here is an example of the case:
I input names under Customer request
I enter percentage for position under Percentage
In amount calculation I use =CEILING($C$5*C10;10) and in all the rest of the cells the same to get numbers look nice. It is working fine but he problem is that now totals does not match. It should end up in 15550 but after calculating totals after split it is 15660.
Is there any ideas what kind of master artificial intelligent formula can do the trick to produce nice looking numbers, taking in consideration to match Total (target) in the end if Total (calculated) percentage is 100%?
P.S. Any ideas are welcomed as well. The target is to have nice looking, rounded numbers that will sum in the same number as target - total.
Since you are using CEILING, your output number (e.g. 15660) is guaranteed to be greater than or equal to your input number (e.g. 15550). This is because any time a "perfect match" isn't found, it rounds up.
My first suggestion is to instead use ROUND instead of CEILING. Right off the bat this will perform better than CEILING because ROUND can round up or down but CEILING can only round up.
E.g. try this:
= ROUND($C$5*C10,-1)
Since you provide no details as to "how" the data needs to be adjusted to meet your input value, I can't really provide any automatic solution.
One manual solution is that you can make a new column which indicates whether the data was rounded up or rounded down, and you can adjust the percentages manually to get the data you're looking for.
Here's a formula to tell you if the data is rounded up or down (e.g. put formula in cell E10 and drag down):
= CHOOSE(SIGN(D10-($C$5*C10))+2,"Round Down","Perfect Match","Round Up")
You can use this information to manually tweak your percentages. For example... if your output value is too high, you can slightly decrease some of the higher percentages that "Round Up" and slightly increase some of the lower percentages (e.g. if you have 10% and 3%, maybe change them to 10.1% and 2.9% to see if that makes a difference.)
I have got some list of shops. I have to allocate shipments based on their rankings. The allocation should happen in such a way that each shop should not get less than 25 shipments and more than 100 shipments. The actual question is explained below.
Total SHipments=150
Shop Id A B C D E
Allocation (%) 30% 28% 25% 10% 7%
Min. 25 25 25 25 25
Max. 100 100 100 100 100
Actual Allocation %*150
=45 42 37 15 11
My Requirement 45(>25) 42(>25) 37(>25) 25(<25) 1(<25)
So my requirement is based on the ranking, the excel should allocate actual allocation to the top rankers (Between 25 to 100) and as the ranking goes down, it should fulfil the need of better ranker and make it 25 and then allocate the rest.I think I have made the question clear but let me know if still ambiguity is there. I'm new to this community. Forgive me if I'm not able to post the question in proper way.
To get your required results based on the information in your table layed out in the manner in the screen shot below, use the following formula:
=INT(MIN(MAX($C$1*B$5,B$7),B$9))
The above formula is placed in Cell B16. The INT was used as your results for 37.5 was 37.
In cell C16 place the following formula and copy it to the right as required. This is based on the allocation being in descending order from left to right:
=IF(SUM($B$16:B$16)+INT(MIN(MAX($C$1*C$5,C$7),C$9))<=$C$1,INT(MIN(MAX($C$1*C$5,C$7),C$9)),$C$1-SUM($B$16:B$16))
The max function is used to return the minimum value. When your formula returns a result below the minimum value The max function returns the minimum value. The MIN function does the same when the result of the formula exceeds the maximum allowable value. It will return the maximum allowed value as it is the minimum of the two numbers.
UPDATE: Rank out of order
This does not work when their is a tie and total demand exceeds available shipments
I took your table and added a helper row to determine RANK Row 6. I used the following formula to come up with the rank
=RANK(B5,$B$5:$F$5)
With this method, it is possible to have ties. You can investigate how to come up with unique rank with ties. The rest of this solution will assume the there are no ties in rank.
In Row 11 the "demand" of each shop is calculated based on Max and Min constraints and is rounded down to the nearest integer. The following formula is placed in B11 and copied right:
=ROUNDDOWN((MAX(MIN(B5*$C$1,B9),B7)),0)
In row 13 the actually amount to ship or "supply" is determined with the following formula in B13 and copied to the right.
=IF(SUMPRODUCT(($B$6:$F$6<=B6)*$B$11:$F$11)<=$C$1,B11,MAX($C$1-SUMPRODUCT(($B$6:$F$6<=(B6-1))*$B$11:$F$11),0))
FYI - SUMPRODUCT performs array like calculations within it. As a result, avoid using full column/row references such as A:A and instead reduce the range to your data or something closer to it to avoid a lot of excess calculation which may bog down your system. This is particularly true when the formula is repeated in multiple cells.
I am trying to use excel solver to calculate a total number of hours by person when as well as some of their rates when I am provided with the Total Amount and I already know some of the rates.
Screenshot of worksheet
I know the following constraints will apply:
-Rates must integers divisible by 5
-Hours must be rounded to the tenth's place
-Rates will have a ">=" value depending on the worker
Thoughts on how to constrain the results to the variable cells this way so the rates will end in 5 or 0, and the hours will only stop at the tenth's place instead of returning 4.99663675 as a result?
I am trying to use Microsoft Excel to format a large set of data. The data is all in decimal format and the results are paired so that we have 2 values per record. The first value is a Mass in grams, and the second value is the Uncertainty of that mass also in grams.
For example:
SampleName = S1, Mass(g) = 28.695, Uncertainty(g) = 1.601133
What I need to do is have the "Uncertainty" update to 2 significant figures, then depending on the value returned, have the "Mass" update to match the number of decimal places (or whole numbers) that the "Uncertainty" now is.
e.g.
if Uncertainty became 1.6, then Mass should become 28.6
if Uncertainty became 1.61, then Mass should become 28.69
if Uncertainty became 2, then Mass should become 29
I have attempted to use the ROUND function on the "Uncertainty" cell but then I don't know how to make the "Mass" cell update accordingly.
I have tried the following 2 ROUND formulas, which both seem to work for rounding the "Uncertainty":
=ROUND(A1,2-INT(LOG(ABS(A1))))
=ROUND(A1, 2)
Any help would be much appreciated.
This formula counts the number of decimal places in a given cell:
=LEN(RIGHT(A1,LEN(A1)-FIND(".",A1)))
So you could use this in your Round formula where you specify the number of decimals:
=ROUND(A1, LEN(RIGHT(A1,LEN(A1)-FIND(".",A1))))
To round to 2 significant figures you can use something like this:
=ROUND(uncertainty,2-(1+INT(LOG10(ABS(number)))))
To round (eg) B2 based on number of decimals in (eg) D2:
=ROUND(B2,IFERROR(LEN(RIGHT(D2,LEN(D2)-FIND(".",D2))),0))