+ Reply to Thread
Results 1 to 19 of 19

Excel Recursive function or not..! Pl help

Hybrid View

xsmash Excel Recursive function or... 09-11-2013, 08:25 PM
Tony Valko Re: Excel Recursive function... 09-11-2013, 08:33 PM
FDibbins Re: Excel Recursive function... 09-11-2013, 08:35 PM
xsmash Re: Excel Recursive function... 09-12-2013, 12:14 AM
mlcb Re: Excel Recursive function... 09-12-2013, 01:01 AM
mlcb Re: Excel Recursive function... 09-12-2013, 02:01 AM
xsmash Re: Excel Recursive function... 09-12-2013, 02:12 AM
mlcb Re: Excel Recursive function... 09-12-2013, 02:25 AM
mlcb Re: Excel Recursive function... 09-12-2013, 02:42 AM
xsmash Re: Excel Recursive function... 09-12-2013, 03:27 AM
davidm Re: Excel Recursive function... 09-12-2013, 03:48 AM
mlcb Re: Excel Recursive function... 09-12-2013, 10:13 AM
xsmash Re: Excel Recursive function... 09-12-2013, 09:19 PM
mlcb Re: Excel Recursive function... 09-12-2013, 10:18 PM
Teethless mama Re: Excel Recursive function... 09-12-2013, 10:43 PM
mlcb Re: Excel Recursive function... 09-13-2013, 12:54 AM
xsmash Re: Excel Recursive function... 09-13-2013, 06:14 AM
arlu1201 Re: Excel Recursive function... 09-13-2013, 06:25 AM
xsmash Re: Excel Recursive function... 09-13-2013, 09:17 PM
  1. #1
    Registered User
    Join Date
    08-31-2013
    Location
    Denver,CO
    MS-Off Ver
    Excel 2010
    Posts
    9

    Excel Recursive function or not..! Pl help

    First off, I am not stupid but I have a hard time framing a question. But here is the situation

    Take any number between 1 to 18
    Add the numbers 9 or 18 based on user choice to get the result one less than the result
    That is..1+9 = 9. I start on 1 and end on 9 or 18.

    If the result is more than 18, it needs to start over from 1.
    1,2,3...17,18,1,2,3.....

    Is this a recursive function, or something else?
    For the ones of you who know Golf, this makes hella more sense to you.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel Recursive function or not..! Pl help

    I know golf but I'm struggling to understand what you want to do.

    If your question is related to golf then explain it in a golf scenario.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: Excel Recursive function or not..! Pl help

    I dont know gold and Im still struggling to understand what you are trying to do?

    1+9 = 9?????

    I know Im getting old, and things change in schools, but I didnt think they would change basic math?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    08-31-2013
    Location
    Denver,CO
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Excel Recursive function or not..! Pl help

    ok, that is fair.So..

    I am starting at hole no 1. If I play 9 holes, I end at hole number 9. If I play 18-hole round, I end at hole 18.
    (so we are counting the hole that we start on..therefore 1+9=9...!)

    If I play a 9-hole scramble, I can start only on the hole that I am assigned. Therefore I could start at hole 5, I end at hole 13. If I start at hole 13, I end at hole 3.
    If I play a 18-hole scramble,I could start at hole 5, I end at hole 4. If I start at hole 13, I end at hole 12.

    For those that are not golf-savvy
    Front nine- 1 through 9 (holes)
    Back nine - 10 through 18 (9 holes)
    ..and only in a tournament, start any hole and end after playing 9 or 18, hole 1 following hole 18.

    I need to set up my excel so that I enter a starting hole and provide 2 scenarios (Playing 9 or 18, format of play - regular or scramble) and I should automagically be provided the finishing hole, completing the four columns- Starting hole,9/18, Format, Finish hole. Phew...a formula for the Finish Hole calculation is what I need to get.Savvy?
    Last edited by xsmash; 09-12-2013 at 12:41 AM.

  5. #5
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Excel Recursive function or not..! Pl help

    Maybe


    A
    B
    C
    D
    1
    Starting
    9/18
    Format
    End
    2
    5
    9
    4
    3
    4
    18
    3
    4
    1
    9
    9
    5
    1
    18
    18
    6
    2
    9
    1
    7
    14
    18
    13
    8
    8
    9
    7
    9
    9
    9
    8
    10
    18
    18
    17
    11
    17
    18
    16


    Formula in D2 copied down
    =IF(A2=1,B2,MOD(A2+B2-1,B2))
    Marcelo Branco

  6. #6
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Excel Recursive function or not..! Pl help

    Are possible cases like these in the rows 13, 14 and 15 (red)?

    If so, what are the expected results?


    A
    B
    C
    D
    1
    Starting
    9/18
    Format
    End
    2
    5
    9
    4
    3
    4
    18
    3
    4
    1
    9
    9
    5
    1
    18
    18
    6
    2
    9
    1
    7
    14
    18
    13
    8
    8
    9
    7
    9
    9
    9
    8
    10
    18
    18
    17
    11
    17
    18
    16
    12
    9
    18
    8
    13
    17
    9
    ?
    14
    18
    9
    ?
    15
    10
    9
    ?

  7. #7
    Registered User
    Join Date
    08-31-2013
    Location
    Denver,CO
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Excel Recursive function or not..! Pl help

    Thanks! It works for all cases except...[LIST] starting hole is not 1 and 9/18 is 9. In the table, rows 6,8,9

    17 - 9 - 7 (17+9-1-18 = 7)
    18 - 9 - 8 (18+9-1 = 8)
    10 - 9 - 18 (10+9-1 = 18)

    Basically, we need to recount starting from 1, after the summation goes over 18, if not remain as is.
    I subtract 1 just to include the starting hole or its over by 1 all the time.

  8. #8
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Excel Recursive function or not..! Pl help

    Thanks! It works for all cases except...[LIST] starting hole is not 1 and 9/18 is 9. In the table, rows 6,8,9

    17 - 9 - 7 (17+9-1-18 = 7)
    18 - 9 - 8 (18+9-1 = 8)
    10 - 9 - 18 (10+9-1 = 18)

    Basically, we need to recount starting from 1, after the summation goes over 18, if not remain as is.
    I subtract 1 just to include the starting hole or its over by 1 all the time.
    Re thinking
    Last edited by mlcb; 09-12-2013 at 02:27 AM.

  9. #9
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Excel Recursive function or not..! Pl help

    See if this is ok


    A
    B
    C
    D
    1
    Starting
    9/18
    Format
    End
    2
    5
    9
    13
    3
    4
    18
    3
    4
    1
    9
    9
    5
    1
    18
    18
    6
    2
    9
    10
    7
    14
    18
    13
    8
    8
    9
    16
    9
    9
    9
    17
    10
    18
    18
    17
    11
    17
    18
    16
    12
    9
    18
    8
    13
    17
    9
    7
    14
    18
    9
    8
    15
    10
    9
    18



    Formula in D2 copied down
    =IF(A2+B2-1<=18,A2+B2-1,MOD(A2+B2-1,B2))
    Last edited by mlcb; 09-12-2013 at 02:44 AM.

  10. #10
    Registered User
    Join Date
    08-31-2013
    Location
    Denver,CO
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Excel Recursive function or not..! Pl help

    Yes sir, that works with IF statements...!
    But I don't want to use If statements, reason why I didn't mentioned the conditional statements in the first post.
    There has to be a way, with a algebraic formula.
    Or, I am not being a pest...and is this the only way?!

  11. #11
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    316

    Re: Excel Recursive function or not..! Pl help

    Is there any earhtly good reason why you want to avoid uing IF statement?

  12. #12
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Excel Recursive function or not..! Pl help

    Quote Originally Posted by xsmash View Post
    Yes sir, that works with IF statements...!
    But I don't want to use If statements, reason why I didn't mentioned the conditional statements in the first post.
    There has to be a way, with a algebraic formula.
    Or, I am not being a pest...and is this the only way?!
    Well, I don't understand why you cannot use IF statements.

    That said, try this formula in D2 copied down

    =(A2+B2-1)*(A2+B2-1<=18)+MOD(A2+B2-1,B2)*(A2+B2-1>18)

    (hope that MOD is not blacklisted...)

  13. #13
    Registered User
    Join Date
    08-31-2013
    Location
    Denver,CO
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Excel Recursive function or not..! Pl help

    Beautiful, thanks for the help! I have some more burning queries..and I won't hesitate to ask!

  14. #14
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Excel Recursive function or not..! Pl help

    Quote Originally Posted by xsmash View Post
    Beautiful, thanks for the help! I have some more burning queries..and I won't hesitate to ask!
    You are welcome.

  15. #15
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Excel Recursive function or not..! Pl help

    If you don't mind with this function IFERROR() then try this. It looks almost 50% shorter and much more elegant than mlcb has given you.


    =IFERROR(1/(1/MOD(A2+B2-1,18)),18)

  16. #16
    Forum Contributor
    Join Date
    12-22-2010
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010, 2016
    Posts
    209

    Re: Excel Recursive function or not..! Pl help

    Quote Originally Posted by Teethless mama View Post
    If you don't mind with this function IFERROR() then try this. It looks almost 50% shorter and much more elegant than mlcb has given you.


    =IFERROR(1/(1/MOD(A2+B2-1,18)),18)
    Nice Formula!

    My formula, without IFs, can be shortened (simplified) and also be quite elegant

    =MOD(A2+B2-1,19)+(A2+B2>19)

  17. #17
    Registered User
    Join Date
    08-31-2013
    Location
    Denver,CO
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Excel Recursive function or not..! Pl help

    Thank you kindly to you both. That is indeed elegant.
    If statements when eventually coded into programming gets tedious. Hence the aversion. A simple function is always elegant!

    Pl have a look at a new post that I created, with the same subject that requires calculation. Any help is appreciated

    http://www.excelforum.com/excel-form...75#post3404775

  18. #18
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Excel Recursive function or not..! Pl help

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  19. #19
    Registered User
    Join Date
    08-31-2013
    Location
    Denver,CO
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Excel Recursive function or not..! Pl help

    thanks! will do.

+ 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. Some One Help me write Recursive function on my Code
    By jatin89 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2013, 07:40 PM
  2. Recursive function that updates columns
    By lundy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2012, 04:25 PM
  3. writing a recursive function
    By rmoney in forum Excel General
    Replies: 6
    Last Post: 07-19-2010, 02:59 PM
  4. Recursive/Running Function
    By goldm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2009, 08:34 AM
  5. [SOLVED] close workbook without closing excel and stop recursive function
    By chris in forum Excel General
    Replies: 3
    Last Post: 07-10-2006, 03:29 PM

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