Excel RoundUp with IF statement not working. - excel

I am trying to capture items that are > 80% to multiply by 3, IF not, to multiply by the percentage given, then round up1]1. However, I'm receiving a message that I have too few arguments for this function.
=ROUNDUP(IF(H2>.79,G2*3*H2,IF(H2<.8,G2*3*H2,0)))

The RoundUP() requires two arguments. The second sets the place to which to round.
=ROUNDUP(IF(H2>.79,G2*3*H2,IF(H2<.8,G2*3*H2,0)),2)
This will round up to the hundredth place. The 2 is the significant diggits in the decimal. To do it to the Tens it would be -1. To the integer 0.

Your call to roundup requires two pieces:
a number to round
a number of decimal places to round to
You have only provided the first. By adding the bolded bit in the formula below (with whatever level of specificity you choose) it will run properly:
=ROUNDUP(IF(H2>0.79,G2*3*H2,IF(H2<0.8,G2*3*H2,0))**,0**)

Related

Excel rounds up number in one record, rounds down the same number in another

Excel is rounding numbers inconsistently that is causing me issues. When using ROUND(), sometimes it rounds a specific number up, while at other times it rounds the same value down.
I've tried setting Excel to show exact values in settings, but it doesn't change anything.
This is an example of what is happening.
This is the simple formula ROUND((A1-B1)/2,4)
For one record I have the values (.3159 - .3152) which evaluate to .0007 then divide by 2 to get .00035.
For the next record I have the values (.3554 - .3547) which also evaluates to .0007 and divided by 2 results in .00035
So, even though both values are .00035 when I round off to 4 decimal places I am getting .0003 for one and .0004 for another. Same number, rounding to the same number of places, two different results. How can I fix this?
This is an issue with floating point numbers that is inherent and cannot be solved, only avoided.
Try these tests in Excel:
=(0,3159-0,3152)=(0,3554-0,3547) gives you FALSE.
=(0,3159-0,3152)-(0,3554-0,3547) gives you something like 5.55112E-17.
If you cannot accept the differences, you should round already in the middle of the calculation, not only at the end:
=ROUND(0.3159-0.3152,4)=ROUND(0.3554-0.3547,4) is TRUE
=ROUND(0.3159-0.3152,4)-ROUND(0.3554-0.3547,4) is 0
further reading: Is floating point arithmetic stable? and Binary floating point and .NET, by highly regarded Jon Skeet.

CEILING Function - Round to next even number

How do I make the CEILING function work to automatically assume a cell value is to the nearest even number?
Examples:
If I have a value of 4.25, how do I get it to automatically round to 6?
If I have a value of 6.25, how do I get it to automatically round to 8?
If I have a value of 7.25, how do I get it to automatically round to 8?
If I have a value of 9.25, how do I get it to automatically round to 10?
Thank you for your help
There is an alternative to CEILING using a little math and ROUNDUP.
=ROUNDUP(A1/2, 0)*2
It may be important to note how CEILING works with negative numbers. CEILING always rounds to the numerically larger number.
For the following examples, assume 3 in A1 and -3 in A2.
=CEILING(A1, 2) 'rounds up to +4
=CEILING(A2, 2) 'rounds up to -2
On the other hand, ROUNDUP always rounds away from zero.
=ROUNDUP(A1/2, 0)*2 'rounds up to +4
=ROUNDUP(A2/2, 0)*2 'rounds away from zero to -4
Conversely, ROUNDDOWN and FLOOR (the inverse of ROUNDUP and CEILING) operate in the same manner by in the opposite 'direction'.
Use CEILING(A1, 2). CEILING rounds the first parameter up to the nearest multiple of the second parameter.

Function that returns number of significant figures after decimal point in specific formatting

Wondering if anyone knows a function that would return the number of significant figures after a decimal point? And even further how to put that number in a specific formatting?
For example if the number was 27.9834 it would return 0.0001. Or if it was 2.1 it would return 0.1.
You should be able to do this using a LEN and MATCH to get the number of decimal points, then its a simple "^" function to get the decimal place.
Assuming your number is in Cell A1:
=10^-(LEN(A1) - FIND(".",A1))
Just make sure you are showing the right number of significant digits in the result cell or it will just look like zero.
The LEN() counts the number of characters and then you subtract the number of characters from the left to where the decimal is. I think there is an upper limit on the number of decimals that excel can handle, but i don't recall what it is.
Another method might be,
=AGGREGATE(14, 6, POWER(10, -(ROW($1:$16)-1))/(TRUNC(A2, ROW($1:$16)-1)=A2), 1)

How to calculate modulus without the operator and any round function?

I have to calculate the modulus of a number to check if it's even or not, but the only instruction to compare two numbers is checking if they're equal, and there isn't the modulus operator and a function\operator to round numbers.
A way to round numbers would be an alternative to modulus operator, but i can't find a solution to either modulus and round.
Just need a pseudo code to work with.
We're learning some assembly basics at school with a "pseudo" assembly (DuplOne).
Thanks in advance!
Assuming the number to test is not negative, and that subtract and jump instructions are available, check if the number is 1 (i.e. the original number was odd) or 0 (i.e. the original number was even), otherwise subtract 2 and go back to the checks.
:label
if number = 1 then
original number is odd
finish
if number = 0 then
original number is even
finish
subtract 2 from number
go to label

How to round a value In Excel

I want to round off the value in Excel when the value is greater than 5 after decimal.
For example:
if num= 9.15, result= 9.1
if num= 9.16, result = 9.2
Although your need contradicts the currently valid rounding rules it could be achieved with the following formula:
=TRUNC($A1*10^1+0.4*SIGN($A1))/10^1
The value in A1 can be any decimal value in any length either positive or negative. It will be "rounded" to 1 decimal place. The 10^1 part in the formula leads to rounding to 1 decimal place. Use 10^2 to round to 2 decimal places and so on.
For the second decimal place, I was going to post
=IF(AND(FIND(".",A2&".")=(LEN(A2)-2),RIGHT(A2)="5"),--LEFT(A2,LEN(A2)-1),ROUND(A2,1))
(modified according to #Jasen's comment)
A very simple approach is
=ROUND(A4-10^-10*SIGN(A4),1)
which should be fine up to several places of decimals if you change the number of decimals to round (but will fail because of rounding errors if the numbers are too large).
This also gives good results over a wide range of numbers:-
=ROUND(A2-A2/10^12,1)
To generalise the first one a bit more you could try
=IF(ISNUMBER(FIND(".",A2)),IF(RIGHT(A2)="5",--LEFT(A2,LEN(A2)-1),ROUND(A2,LEN(A2)-FIND(".",A2)-1)),A2)
to round the last decimal place down if it's a 5.
this should do it
=ceil(A1*10-0.5)/10

Resources