Saturday, June 21, 2008

Utility of 'round' function

Consider a case when you get an excel sheet having mathematical calculations with large numbers and you have to cross-check some of the quantities or you have to pick up some numbers for your own calculations. You might have experienced some differences in the quantities after multiplication (or any other mathematical operation). You are doing no mistake at all (as you think), and to make yourself more convinced you have used your fx-991 calculator to check the correctness. Let me convey my point by an example here. Suppose, you see a quantity in a cell 623.32 which is multiplied by 72345. You are picking up these two quantities and multiplying and getting the value 45094085.4. But in the original sheet it is showing 45094606.28. A difference of 520.88. Suppose this is amount of money in dollar..! Then you know, this silly Excel can make this much fraud.Now I tell you where Excel is doing mistake (in fact, it's you doing mistake here). You see the number 623.32 is not actually 623.32. It's 623.3272. (No magic here). Excel is showing this value because it has been allowed to show only two decimal digits in the set-up.( you can check- Right click on that cell, select 'Format Cell' and then select 'number' and you are there). So it is following some order given to it and showing only two decimal digits but it doesn't mean that it has changed the number from 623.3272 to 623.32. It's just showing 623.32 but if this number is used for any calculation in Excel itself, it would use the value 623.3272. But while verifying your calculation, you were using only 623.32 as you were able to see only that much. Now you can say that, ok, you change the digit limit upto four decimal points. But how sure you could be that the actual value of the number is only up to four decimal points. It could go upto more than four. In that case you would be in trouble again....!!There is a function called 'round'. This ensures that it’s showing the actual value upto your desired decimal limits. To be used as ‘round (quantity, no of decimal digits)'. E.g. round (number1*number2, 2). This will show the value of number1 multiplied by number2 rounded off upto two decimal points only. So, before picking up quantities, you first apply this command on all the cells you wanna use and then enjoy the power of the EXCEL.

No comments: