+ Reply to Thread
Results 1 to 15 of 15

Needing Help on a If then Then Function

  1. #1
    Registered User
    Join Date
    07-15-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    19

    Needing Help on a If then Then Function

    Hello,
    I am building a spread sheet for hypothetical returns in a retirement annuity. I can use a standard return of a percentage in some cases.
    In other cases I am using a =RANDBETWEEN(0,999)/100 function to get a percentage between 0 and 10%. This works well.
    However, we all know that sometime the market can give a low or negative return over the year. My annuity uses S&P Index Future to only capture and credit the upside in a market, eliminating any negative returns in the product owned by the retiree.
    In that case I would like to create a function that works like this
    "If percentage is greater than say 2% make no change... if 1.99% or less, then enter zero.


    Is This doable? It seems simple, but I am an excel novice.

    Thank you in advance

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,790

    Re: Needing Help on a If then Then Function

    How about this?

    =IF(RANDBETWEEN(0,999)/100>=0.02,RANDBETWEEN(0,999)/100,0)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Needing Help on a If then Then Function

    That won't work...as RANDBETWEEN runs twice, once with the >0.02* criterion and once without it.... so the first RANDBETWEEN can be TRUE and the second one be less than 2%...

    * It should be 2, not 0.02, but in any event, it doesn't work...
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,790

    Re: Needing Help on a If then Then Function

    Ah, yes - silly me (on both counts)!!!

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Needing Help on a If then Then Function

    I think you need 2 columns... in A1, copied down
    =RANDBETWEEN(0,999)/100

    and in B1, copied down:
    =IF(A1<=2,0,RANDBETWEEN(200,999)/100)
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Needing Help on a If then Then Function

    My turn to get it wrong. Use this:

    =IF(RAND()<=0.2,0,RANDBETWEEN(200,999)/100)

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,790

    Re: Needing Help on a If then Then Function

    How does that stop the RANDBETWEEN from generating a number lower than 2?

  8. #8
    Registered User
    Join Date
    07-15-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    19

    Re: Needing Help on a If then Then Function

    Hello Ali,
    That was fast resspnse. I have entered it, it still seems to be returning values <2.0.
    Can I send you this sheet to review?

    Thank you

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Needing Help on a If then Then Function

    Should have gone to Specsavers... (I was there yesterday...)

    =IF(RAND()<=0.2,0,RANDBETWEEN(200,999)/100)

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,790

    Re: Needing Help on a If then Then Function

    So it would appear ... Should have gone to Specsavers!!!

  11. #11
    Registered User
    Join Date
    07-15-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    19

    Re: Needing Help on a If then Then Function

    Hello Glenn,
    I think you have solved it., I have to run out for the rest of the day ( arrgh, part time job), but will apply it when I get back tonight from your sheet into mine.
    Thank you, Thank you.

    Pete

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,790

    Re: Needing Help on a If then Then Function

    Thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Needing Help on a If then Then Function

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  14. #14
    Registered User
    Join Date
    07-15-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    19

    Re: Needing Help on a If then Then Function

    Hello Glenn.
    I used your solution. It works great. However, column B is doing a new RANDBETWEEN calculation.
    I would like column B to hold the results from Col A that are >2 but enter those results in col A that are <2 as zero with out a new calculation in that cell in Col B.
    Is that do-able?

    Thanking you in advance for your knowledge and time.
    Pete

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Needing Help on a If then Then Function

    See post 6...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] trouble with IF and then formula needing mathematical function
    By jenwebber3 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 09-24-2018, 05:24 PM
  2. [SOLVED] Formula help! Lookup function needing to be used to return largest value
    By jkhoury1 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-10-2017, 02:12 PM
  3. Total newbie needing help with IF/OR function
    By Elkae in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-02-2013, 07:43 PM
  4. STR Function needing to be constantly refreshed
    By MWE2012 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-28-2012, 10:00 AM
  5. Needing help with IF, AND Function?
    By jbolinger in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-01-2011, 11:52 AM
  6. Pulling a worksheet name from cell value (custom function needing help)
    By Kurisu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2006, 09:09 PM
  7. [SOLVED] student needing help w/vlookup function grading criteria
    By Julie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-21-2005, 09:05 AM

Tags for this Thread

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