+ Reply to Thread
Results 1 to 9 of 9

Need Odd # to Roll to Even #

  1. #1
    Registered User
    Join Date
    12-26-2009
    Location
    Moore, Oklahoma
    MS-Off Ver
    Excel 2007
    Posts
    20

    Need Odd # to Roll to Even #

    I have the following formula =IFERROR(ROUNDUP((+G5+G23+G41+G59)/4,0),"") that if it returns an odd number as in 3 or 5 or 7 or etc i want it to display 4 or 6 or 8 or etc. All help is greatly appreciated.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Need Odd # to Roll to Even #

    I came up with this quickly. There is possibly something slightly more elegant but it works:

    =IFERROR(ROUNDUP((+G5+G23+G41+G59)/4,0)+MOD(ROUNDUP((+G5+G23+G41+G59)/4,0),2),"")

    To clean things up a bit, if you put this

    =ROUNDUP((+G5+G23+G41+G59)/4,0)

    in a separate cell (let's say A2), then your formula collapses to

    =IFERROR(A2+MOD(A2,2),"")

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Need Odd # to Roll to Even #

    This works for one cell
    =IF(ISEVEN(A1),A1,A1+1)
    So I suppose this would work

    =IF(ISEVEN(SUM(G5,G23,G41,G59)/4),SUM(G5,G23,G41,G59)/4,(SUM(G5,G23,G41,G59)/4)+1)

  4. #4
    Registered User
    Join Date
    12-26-2009
    Location
    Moore, Oklahoma
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Need Odd # to Roll to Even #

    When I put into the spreadsheet where I had a 3 it showed a 2. I changed this portion of the formula /4,0)2),"") to /4,0)4),"") and it showed a 4 so it seems whatever number you have in that blank is what it shows. Thoughts?????????

  5. #5
    Registered User
    Join Date
    12-26-2009
    Location
    Moore, Oklahoma
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Need Odd # to Roll to Even #

    Tried the new one and it comes back a 3. Seems the +1 par tof that isn't working. Thought???????

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Need Odd # to Roll to Even #

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need Odd # to Roll to Even #

    Maybe:

    =CEILING((+G5+G23+G41+G59)/4,1) + MOD(CEILING((+G5+G23+G41+G59)/4,1),2)

    Or

    =CEILING(AVERAGE(G5,G23,G41,G59),1) + MOD(CEILING(AVERAGE(G5,G23,G41,G59),1),2)
    Last edited by JBeaucaire; 01-29-2010 at 10:03 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Need Odd # to Roll to Even #

    Quote Originally Posted by tnoble17 View Post
    When I put into the spreadsheet where I had a 3 it showed a 2. I changed this portion of the formula /4,0)2),"") to /4,0)4),"") and it showed a 4 so it seems whatever number you have in that blank is what it shows. Thoughts?????????
    You may have made an error. I tested this thoroughly and for all sums where your formula shows a 3 (sums 9-12), mine shows a 4. I agree with davesexcel, you need to show us.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need Odd # to Roll to Even #

    Maybe just =IFERROR(CEILING((G5+G23+G41+G59) / 4, 2), "")

    Or =IFERROR(CEILING(AVERAGE(G5, G23, G41, G59), 2), "")
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1