Ask Experts Questions for FREE Help !
Ask
    gramon's Avatar
    gramon Posts: 2, Reputation: 1
    New Member
     
    #1

    May 23, 2007, 10:32 PM
    Rounding numbers to specific criteria
    Hi,
    I am working on spreadsheets with values that I want to be able to round up based on this criteria:

    If the number ends in 0,1,2, then round to nearest 0
    If the number ends in 3,4,5, then round to nearest 5
    If the number ends in 6,7,8,9 then round to nearest 9

    The spreadsheet contains dollar values and the majority are in the thousands, so they have 4-5 digits each.

    I was trying to create an IF statement that would look at the value, identify the last digit of the value as defined above and then round the number accordingly.

    So if I have a value of $1,991 the formula would round the number to $1,990
    or if I have a value of $1,993 the formula would round the number to $1,995
    and if I have a value of $1,996 the formula would round the number to $1,999.

    I am working with thousands and thousands of cells so a formula would be so helpful instead of going through the sheet. I have tried the MROUND and CEILING formulas but I can not round to the nearest "9" with those types of formulas.

    Your help is greatly appreciated.
    WvR's Avatar
    WvR Posts: 16, Reputation: 3
    New Member
     
    #2

    May 24, 2007, 12:02 AM
    Quote Originally Posted by gramon
    Hi,
    I am working on spreadsheets with values that I want to be able to round up based on this criteria:

    If the number ends in 0,1,2, then round to nearest 0
    If the number ends in 3,4,5,, then round to nearest 5
    If the number ends in 6,7,8,9 then round to nearest 9

    The spreadsheet contains dollar values and the majority are in the thousands, so they have 4-5 digits each.

    I was trying to create an IF statement that would look at the value, identify the last digit of the value as defined above and then round the number accordingly.

    So if I have a value of $1,991 the formula would round the number to $1,990
    or if I have a value of $1,993 the formula would round the number to $1,995
    and if I have a value of $1,996 the formula would round the number to $1,999.

    I am working with thousands and thousands of cells so a formula would be so helpful instead of going through the sheet. I have tried the MROUND and CEILING formulas but I can not round to the nearest "9" with those types of formulas.

    Your help is greatly appreciated.
    you can combine the IF, REPLACE function to this

    =REPLACE(D11,LEN(D11),1,IF(VALUE(RIGHT(D11))<3,0,I F(VALUE(RIGHT(D11))<6,5,IF(VALUE(RIGHT(D11))<10,9, 0))))

    where D11 is the cell with the $amount

    LEN(D11) ensures that you will get the right answer for any length of numbers

    Hope this helps
    gramon's Avatar
    gramon Posts: 2, Reputation: 1
    New Member
     
    #3

    May 25, 2007, 01:12 PM
    Quote Originally Posted by WvR
    you can combine the IF, REPLACE function to this

    =REPLACE(D11,LEN(D11),1,IF(VALUE(RIGHT(D11))<3,0,I F(VALUE(RIGHT(D11))<6,5,IF(VALUE(RIGHT(D11))<10,9, 0))))

    where D11 is the cell with the $amount

    LEN(D11) ensures that you will get the right answer for any lenght of numbers

    Hope this helps

    Thanks for the response. I tried the formula in my spreadsheet and this is what the formula gave me:
    Original # FORMULA CALCULATIONS
    2,791 2790.76923076925
    2,960 2960
    246 246.153846153849
    246 246.153846153849
    2,922 2921.53846153849
    3,091 3090.76923076925
    2,922 2921.53846153849
    3,091 3090.76923076925
    246 246.153846153849

    It's round after the decimal. Not sure why. The formal was a little more "complicated" so I don't quite understand the logic, otherwise I might be able to figure out why it is doing this...
    Thanks!
    WvR's Avatar
    WvR Posts: 16, Reputation: 3
    New Member
     
    #4

    May 27, 2007, 11:30 PM
    sorry my fault - I didn't cater for decimals, this should fix the problem

    =REPLACE(ROUND(D11,0),LEN(ROUND(D11,0)),1,IF(VALUE (RIGHT(ROUND(D11,0)))<3,0,IF(VALUE(RIGHT(ROUND(D11 ,0)))<6,5,IF(VALUE(RIGHT(ROUND(D11,0)))<10,9, 0))))

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Criteria for Dual-Status Filing [ 0 Answers ]

Ladies and Gentlemen: I spoke with the International Tax representatives at the IRS in mid-January. I was not satisfied with some guidance I had received regarding the requirements of dual-status tax reporting. Here is the new guidance direct from the IRS: Dual-status is required if the...

Excel rounding [ 1 Answers ]

ELATHAM How do I keep Excel from Rounding off. When it rounds off it makes my final totals wrong. My figures need to balance right to the penny. Thank you, Estrella

Counting Cells If several criteria are true [ 1 Answers ]

Another question. I'd like to count the number of cells in column C that have "incorrect" in them, if the corresponding cells in column A have "people" in it, and column B has "intact" in it. So if A = people and B = intact, count all C that = incorrect. Thanks!

Several Criteria Classification on Excel [ 7 Answers ]

Quick question... I'd like to do the following: If the value in Column A is between 1-50 or 200-250 or 400-450, or 600-650 etc etc I want it to be classified as "people" in Column B. If it does not fall in those number ranges, I want it to be classified as "monkey" in Column B. This seems...

Excel: 2 criteria - 1 answer [ 9 Answers ]

GMorning Ladies/Gentlemen! Here's a small question: Is it possible to have two criteria which are filled in by a user, and in a third box an answer appears? I have put an example attached in zip format. Many thanks, Srecak


View more questions Search