Excel rounding up or down to specific number - excel

I can't seem to figure out a formula in excel for rounding up or down numbers to end in either 49 or 99.
What I'm looking to do
$824 should round down to $799; $825 should round up to $849; $874 should round up to $899; $873 should round down to $849
The number should round up or down to whichever number it is closest to.

Since it's always 49 or 99 you can use MROUND like this:
=MROUND(A4,50)-1
If you have a reasonably small range and you want other unique values that are not multiples of each other you can use a build-in lookup function like this (replace 'A1' with your value or cell address):
=LOOKUP(A1, {0,575,625,675,725,775,825,875,900}, {"Too Low",599,649,699,749,799,849,899,"Over"})
The lookup function allows you to do odd rounding such as your referring to by rounding 874 up instead of down. Alter the equation like this for this offset.
=LOOKUP(A1, {0,574,625,674,725,774,825,874,900}, {"Too Low",599,649,699,749,799,849,899,"Over"})

=ROUND(A1/50,0)*50-1
Source: http://www.mrexcel.com/forum/excel-questions/24527-round-nearest-50-a.html
So essentially, just round to the nearest 50 then subtract 1.

I agree that rounding of 874 to 899 seems strange. However, if this is not a mistake and can be reasoned, for example, by desire to choose 99 in the case of a tie-break, then here is the solotion:
=IF(ABS(MROUND(A1;100)-1-A1)<=ABS(MROUND(A1;50)-1-A1);MROUND(A1;100)-1;MROUND(A1;50)-1)
Output:
824 799
825 849
873 849
874 899

Related

Dont know how to Select Cell Range For SLOPE Formula

Here is my problem. I want to use =SLOPE formula with a cell range that refers to another sheet with criteria: Date period between Oct-21 until Apr-22, the known_ys = Emiten Name and known_xs = IHSG.
I use this formula:
=SLOPE(IF(AND(Emiten!B:B>=Risk!$A$2;Emiten!B:B<=Risk!$B$2;Emiten!A:A=Risk!D17);Emiten!D:D);IF(AND(Indeks!B:B>=Risk!$A$2;Indeks!B:B<=Risk!$B$2;Indeks!A:A=Risk!$D$2);Indeks!D:D))
But it shows the result #VALUE!, can anyone please tell me where's the problem?
Thanks
AND only ever returns a single value. To simulate 'and' conditions within array constructions, use nested IF statements.
Also, you should not be using entire column references for such a construction, since it will be forced to process several million rows unnecessarily.
Try:
=SLOPE(IF(Emiten!B1:B10>=Risk!A2,IF(Emiten!B1:B10<=Risk!B2,IF(Emiten!A1:A10=Risk!D17,Emiten!D1:D10))),IF(Indeks!B1:B10>=Risk!A2,IF(Indeks!B1:B10<=Risk!B2,IF(Indeks!A1:A10=Risk!D2,Indeks!D1:D10))))
adjusting the last row referenced (10 here) to a suitably low, though sufficient, upper bound.
Also, I take it you are aware that the SLOPE function will only consider rows for which both the known_ys and the known_xs are numeric? For example, assuming that the above resolved to:
known_ys
known_xs
14
FALSE
53
FALSE
FALSE
27
FALSE
FALSE
16
63
58
90
FALSE
FALSE
3
FALSE
80
85
25
40
then SLOPE would ignore everything apart from the the 5th, 6th, 9th and 10th pairs, effectively calculating over the following reduced array:
known_ys
known_xs
16
63
58
90
80
85
25
40

Determine if a range of cell values contain 5 or more consecutive negative values

Trying to figure out a way to determine if a dataset of 'X' values in a column contains 5 or more consecutive negative numbers. If so, how many times does that happen (5 negatives in consecutive cells).
Example data:
-110
-164
-101
-144
-117
0
0
10
15
22
-56
-60
-54
2
10
0
In this example I would expect the result to be "1" since 5 consecutive negative integers occurs only once in the dataset.
I built a nasty nested IF statement run to figure this out but I know there's an easier way.
I cannot seem to get a shorter formula to work.
Appreciate anyone's input
You can try FREQUENCY function:
=SUM(--(FREQUENCY(IF(A:A<0,ROW(A:A)),IF(A:A>=0,ROW(A:A)))>=5))
for older excel versions it must be entered with Ctrl+Shift+Enter

Automate MIN and MAX temperatures for a certain date

I have big amount of data (60k rows) in Excel that is similar to this:
Temperature Humidity Date
20.1 68 22-dec-14
20.3 67 22-dec-14
20.4 65 22-dec-14
20.0 64 23-dec-14
20.5 64 23-dec-14
20.9 65 24-dec-14
21.4 64 24-dec-14
23.4 64 25-dec-14
23.8 65 25-dec-14
23.9 64 25-dec-14
18.4 64 25-dec-14
I created new columns outside this table that contains the individual dates and I want to extract the MAX, MIN and possibly the AVERAGE of that date
DATE MIN MAX AVG
22/Dez/14
23/Dez/14
24/Dez/14
25/Dez/14
I tried but I can't seem to find a way for Excel to work for me. Could you help me?
I suggest you try a PivotTable:
Suppose column A contains the dates, and column B the values. I've allowed 6 rows in each; extend as necessary.
Consider a sample date in $D$1. The formulas you need are:
MIN: =MIN(IF(D1=A1:A6,B1:B6,MAX(B1:B6))). (You need to enter this as an array formula).
MAX: =MAX(IF(D1=A1:A6,B1:B6,MIN(B1:B6))). (You need to enter this as an array formula).
Use AVERAGEIF out of the box.
Remember that you need to press Ctrl + Shift + Return to enter an array formula. Then it's a simple case of copying that formula downwards.
They return the minimum or maximum value of the entire sample if a given date is not present in the set, which might not be desirable. You could adjust this behaviour with a containing IF.
You can take care of the pseudo-MIN/MAX with the AGGREGATE¹ function using the 14 (LARGE) and 15 (SMALL) sub-functions together with the 6 (ignore errors) option and the AVERAGEIF function can take care of the rest.
      
The standard formulas in F2:H2 are,
=AGGREGATE(15, 6, ($A$2:$A$60000)/($C$2:$C$60000=$E2), 1)
=AGGREGATE(14, 6, ($A$2:$A$60000)/($C$2:$C$60000=$E2), 1)
=AVERAGEIF($C$2:$C$60000, $E2, $A$2:$A$60000)
Fill down as necessary. An advantage of this method is that you can get the second, third, etc smallest or largest simply by raising the 1 (k ordinal) number at the right end of the AGGREGATE formula.
¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.

How to create a rounddown in ms excel with range?

I just want to ask a question about creating a rounddown formula in excel.
The logic is to generate a rounddown numbers based on the range.
For example:
90-99 = 90
80-89 = 80
Numbers between 90 to 99 should be 90
And numbers between 80 - 89 should be 80
How can i create a formula for that?
The answer is in the question......
You can use ROUNDDOWN function, i.e.
=ROUNDOWN(A1,-1)
The -1 indicates rounding down to the previous multiple of 10, -2 would give 100, -3 1000 etc.
...or FLOOR function will also work
=FLOOR(A1,10)
Try this formula :
=A1-MOD(A1;10)
Here I have subtracted from the cell's value, the rest of the division of your cell's value with 10 (function modulo)

Rounding in Excel Formula using complex conditions

Hi I need to round up the numbers (last 2 digits, no decimal) based on following conditions:
If from 0 to 64 should be 49
If from 65 – 89 set at 79
If from 90 – 129 set at 99
If from 130 – 164 set at 149
If from 165 – 189 set at 179
If from 190 – 229 set at 199
and so on until 989
Then:
If value is from 989 – 1099 set at 999
If value is from from 1100 – 1249 set at 1199
If value is from from 1250 – 1349 set at 1299
If value is from from 1350 – 1449 set at 1399
and so on until 5000
I would appreciate some info and help how to get a formula to work for this.
Thanks
Harmz
This is not really a rounding problem but more a conversion problem. because there seems to be no pattern to your number groups I don't think it is therefore something you can calculate and therefore you will have to do a lookup.
If you want to do it all in one formula you could use and array inside of a vlookup like the partial example below:
=VLOOKUP(C1,{0,49;65,79;90,99;130,149;165,179},2,TRUE)
Otherwise do it as a normal vlookup. All you need is a two column table table, the first column contains the lower bound of you ranges and the second column contains the value that you want it to be. The important thing is that the vlookup has the final parameter of true, this makes the vlookup find the nearest match.

Resources