How Can I Round Prices to the nearest 0.95 with an Excel Formula? - excel

I need to round up all my prices to the nearest $0.95. For instance I have 23.106 and 102.58888. They would need to be rounded off to $22.95 and $102.95. How can I do this with an excel formula/function?

Try this:
=IF(OR(A3-FLOOR(A3,1)>0.95,A3=CEILING(A3,1)),CEILING(A3,1)+1,CEILING(A3,1))-0.05
If the decimal is greater than .95 or is a whole number (no decimals), it will add add 1 to the number and then use the CEILING function to round the number up and then subtract .05.
1.52 = 1.95
2.00 = 2.95
66.98 = 67.95

Related

Rounding up and rounding down in excel

I don't know how to round up and round down in excel if I have variety of numbers.
For ex: If I have 9.233, then it rounds down to 9 because 0.233 < 0.5, but if it is 2.457, then it rounds up to 3 because 0.457 = 0.5 (if you round it), and then if I have 3.890, then it rounds up to 4 because 0.890 >= 0.5.
I don't know what to do. I tried:
=IF(A1-INT(A1)>0.1,ROUNDUP(A2,0),INT(A2))
but it doesn't work.
Please help
Have you tried just the ROUND(, 0) for your purpose.
This should yeild the desired result.
Num Rounded Num
-----------------------
9.233 9
2.457 2
3.89 4

Choose a random value between 0.00 and 20.00

In Excel, it is possible to select a random value from a set of 5 options in the following manner:
Values
e.g. 15, 30, 50, 75, or 100
Formula
=CHOOSE(RANDBETWEEN(1,5),15,30,50,75,100)
If I wanted to select a value from a much denser range how would I do it?
e.g. 0.00, 0.01, 0.02, 0.03 ,0.04 ,0.05 ... 19.95, 19.96, 19.97, 19.98, 20.00
What would be the correct formulae?
Consider the following formula:
=0.01*RANDBETWEEN(0,2000)
This will produce random multiples of .01
Scale the output of the random function by multiplying/dividing it by a constant.
For instance, if your Random function outputs floating decimal values between 0 and 1, and you need outputs between 0 and 100, multiply the output of the random function by 100.
If you need the final result to be an integer, you can then round the value to the nearest integer.
It sounds like you want
=ROUND(RAND()*20,2)
The 20 is the maximum value of your zero-to-maximum range, and the 2 is how many decimal places it'll round the final output to.

Limit Decimal Places In Generated Numbers in R.Studio

I am a beginner in programmin in general and R specifically.
I would like to generate a set of random numbers in a normal distribution but to limit the decimal places in these numbers to only 2.
I have been using x1 <- runif() to generate my numbers.
Can I add something to it to enable me to only get results rounded off to 2 decimal places?
You can limit the decimal places using the round() function.
If I understand your question correctly this should do the trick:
x1 <- round(
runif(5, min=0, max=1)
, digits = 2
)
x1
The results, which will be different each time, are:
[1] 0.55 0.55 0.75 0.85 0.13

Compare percentage value against decimal Excel

I am a bit stumped with this issue, I was wondering if anyone could suggest a solution. In Excel I have a table which looks like this:
1 2 3 4 5 Result Score
80% 85% 90% 95% 100% 92.5% 3.50
What I am trying to calculate is that proportional score, based on where the result falls within the preset decimal 1-5 score.
Thanks.
In your case where each increment is 5% you could use a simple calculation like
=MAX(0,F2-75%)*20
[where result is in F2]
....but assuming that you want to interpolate the score given potentially less linear values in your table try this formula where your table is in A1:E2
=LOOKUP(F2,A2:E2,A1:E1+(F2-A2:D2)*(B1:E1-A1:D1)/(B2:E2-A2:D2))
for linear interpolation this would be general formula, just name the ranges or replace with cell references:
= (perc - minperc) / (maxperc - minperc) * (maxscore - minscore) + minscore

complex rounding decimals in excel spreadsheet

Have created formula for example =(E2+(G2*37))/290 which returns decimals based on data entered but can't work out how to round the answer to get the following:
If 0 to 0.39 round to 0
If 0.4 to 0.89 round to 0.5
If 0.9 to 1.39 round to 1
If 1.4 to 1.89 round to 1.5
If 1.9 to 2.39 round to 2 etc
Hope my question makes sense. Thanks
Your custom rounding is simply rounding to the nearest 0.5.....but with an "offset" of 0.15. With value to be rounded in A1 you can do that with a simple formula, i.e.
=ROUND(A1*2-0.3,0)/2
or with your calculation in place of A1 that becomes
=ROUND((E2+G2*37)/290*2-0.3,0)/2
It's a bit convoluted but this should work:
=IF(A1 + 0.1 - ROUNDDOWN(A1+0.1;0) < 0.5; ROUNDDOWN(A1+0.1;0); ROUNDDOWN(A1+0.1;0) + 0.5)
where A1 is the cell you want to round.
e.g.
N.B.
This works only for positive numbers.
Ranges are actually:
[0, 0.39999999...] [0.4 , 0.8999999...] ...
or equally:
[0, 0.4) [0.4 , 0.9) ...
You could define a VBA function to do this for you:
Public Function CustomRound(number As Double)
Dim result As Double, fraction As Double
fraction = number - Int(number)
If number <= 0.39 Then
result = 0
ElseIf fraction >= 0.4 And fraction <= 0.9 Then
result = Int(number) + 0.5
Else
result = Round(number, 0)
End If
CustomRound = result
End Function
You would call this as follows:
=CustomRound((E2+(G2*37))/290)
Example:
=CustomRound(0.23) // 0
=CustomRound(1.58) //1.5
=CustomRound(2.12) //2

Resources