+ Reply to Thread
Results 1 to 10 of 10

function that returns interest with different values depending previous cell's results

  1. #1
    Forum Contributor
    Join Date
    09-15-2012
    Location
    las vegas
    MS-Off Ver
    excel 2007
    Posts
    147

    function that returns interest with different values depending previous cell's results

    I have 1,2,3,4, and 5 on A1,B1,C1,D1, and E1, respectively.

    I need a function that results in 20%,19%, 18%, 17%, and 17% on A2,B2,C2,D2, and E2.

    However, if I have, like for example, 0,1,2,3,4,5 on A1,B1,C1,D1,E1, and F1 respectively, the results should be 20%,19%,18%17%, and 17% for B1,C1,D1,E1, and F1, neglecting A1 because it's zero. Meaning, I don't want to give any result when the value is 0.

    Thank you

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: function that returns interest with different values depending previous cell's results

    is it always 1,2,3,4,5
    have you a few examples showing the expected results?
    Last edited by martindwilson; 11-08-2013 at 10:28 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Contributor
    Join Date
    09-15-2012
    Location
    las vegas
    MS-Off Ver
    excel 2007
    Posts
    147

    Re: function that returns interest with different values depending previous cell's results

    1,2,3,4,5 are just hard coded numbers. It can either be any number as long as when the first non-zero number is typed/placed the 20%, 19%..... show up.

    The expected results are the %s.
    Last edited by managingcrap; 11-08-2013 at 10:40 PM.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: function that returns interest with different values depending previous cell's results

    i can only do it with a helper at the moment see attached
    Attached Files Attached Files

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: function that returns interest with different values depending previous cell's results

    hi there. i'm thinking more of the lines of:
    =IF(A1=0,"",LOOKUP(COUNTIF($A1:A1,"<>0"),{1,2,3,4,5},{0.2,0.19,0.18,0.17,0.17}))

    so the 1st non zero number will be 20%? 2nd non zero 19% & so on?


    Edit: actually just:
    =IF(A1=0,"",LOOKUP(COUNTIF($A1:A1,"<>0"),{1,2,3,4},{0.2,0.19,0.18,0.17}))
    Last edited by benishiryo; 11-08-2013 at 11:57 PM.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  6. #6
    Forum Contributor
    Join Date
    09-15-2012
    Location
    las vegas
    MS-Off Ver
    excel 2007
    Posts
    147

    Re: function that returns interest with different values depending previous cell's results

    Benishiryo,

    u are right on "so the 1st non zero number will be 20%? 2nd non zero 19% & so on? " statement.

    However, the result is incorrect when I put, for example, 2,20,1..etc. What I need is the first non-zero number should always result to 20%, the 2nd results to 19%, the 3rd to 18%, the 4th and succeeding numbers to 17%. Meaning, regardless if the numbers are 2,4,6,12, 15 or 5,2,3,16,56, the results should still be 20%,19%,18,17%.....

    Thank you
    Last edited by managingcrap; 11-09-2013 at 12:26 AM.

  7. #7
    Forum Contributor
    Join Date
    09-15-2012
    Location
    las vegas
    MS-Off Ver
    excel 2007
    Posts
    147

    Re: function that returns interest with different values depending previous cell's results

    That's awesome. Thank you.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: function that returns interest with different values depending previous cell's results

    =IF(A1="","",LOOKUP(COLUMNS($A$1:A1)-MATCH(TRUE,INDEX(1:1<>"",0),0)+1,{1,2,3,4,5},{0.2,0.19,0.18,0.17,0.17}))
    should work without helper
    see attached
    i cant get benishiryo 's to work see compare both formulas xlsx
    ah do you actually have 0 or blank?
    if its blank then
    =IF(A1="","",LOOKUP(COLUMNS($A$1:A1)-COUNTIF($A1:A1,"="),{1,2,3,4},{0.2,0.19,0.18,0.17})) would work
    Attached Files Attached Files
    Last edited by martindwilson; 11-09-2013 at 12:18 AM.

  9. #9
    Forum Contributor
    Join Date
    09-15-2012
    Location
    las vegas
    MS-Off Ver
    excel 2007
    Posts
    147

    Re: function that returns interest with different values depending previous cell's results

    martindwilson,

    I tried ur function and it worked.

    Thanks guys. I just hope that one day I can be as good as you guys are with Excel stuff.

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

    Re: function that returns interest with different values depending previous cell's results

    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]

+ 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. Replies: 2
    Last Post: 08-29-2013, 02:57 AM
  2. Replies: 3
    Last Post: 08-21-2013, 07:10 PM
  3. Drop down list depending on previous values
    By OAKLEY in forum Excel General
    Replies: 17
    Last Post: 01-03-2013, 12:54 PM
  4. Generating function results depending on text values.
    By DorothyFan1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-02-2011, 09:07 AM
  5. Replies: 2
    Last Post: 11-15-2006, 06:36 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