+ Reply to Thread
Results 1 to 14 of 14

Expanding a function

  1. #1
    Forum Contributor
    Join Date
    07-26-2013
    Location
    Athens, Greece (born and raised in Sydney, Australia)
    MS-Off Ver
    Excel 2010
    Posts
    114

    Expanding a function

    Hello, unfortunately I can't attach an example at the moment so I wil try to explain my request
    I have a spreadsheet with 20k lines (numbers only), which start on line 6 and I copy paste any one of those lines onto line 5. My purpose is to find matching information on any other lines in order to match line 5. On line 2, row F I have inserted the function : =F$5*0.25
    On line 3, row F I have another function : =F$5-F$2
    On line 4, row F I have another function : =F$5+F$2
    So basically I am trying to find any number from the 20k lines to be within a 25% range of my number on line 5.
    My problem is as follows;
    If the number on line 5 is big (example 100) then my range is big too, whereas if the number on line 5 (example 10) is small then my range is small too which is not helping me.
    Is there a way to expand my function on line 2, row F to do something like;
    If my number on line 5, row F is between the range of 0-5 then the percentage is 50% and if the number is between range 6-10 then the percentage is 40% and if the number is between range 11-15 the percentage is 30% etc
    Thanks for any info.
    John

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

    Re: Expanding a function

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    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

  3. #3
    Forum Contributor
    Join Date
    07-26-2013
    Location
    Athens, Greece (born and raised in Sydney, Australia)
    MS-Off Ver
    Excel 2010
    Posts
    114
    Yes unfortunately I cannot submit an example. Is it possible necessary for this particular query?
    Thanks again

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

    Re: Expanding a function

    For me: yes. It's not easy to visualise it from words, especially your anticipated outcomes, and I don't wish to try to re-type what you already have in front of you. So, I'm out. Over to others.

  5. #5
    Forum Contributor
    Join Date
    07-26-2013
    Location
    Athens, Greece (born and raised in Sydney, Australia)
    MS-Off Ver
    Excel 2010
    Posts
    114
    Ok, maybe someone else can have a look
    Ps; the lines of info are not that important. If you just type in the 3 functions you will understand what I'm trying to achieve. One of the functions needs a tweak though. Thanks

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Expanding a function

    Quote Originally Posted by John Sio View Post
    Is there a way to expand my function on line 2, row F to do something like;
    If my number on line 5, row F is between the range of 0-5 then the percentage is 50% and if the number is between range 6-10 then the percentage is 40% and if the number is between range 11-15 the percentage is 30%
    I am only basing my response on what is quoted above.

    Try something along the lines of this:

    F2 =LOOKUP(F5,{0,6,11},{0.5,0.4,0.3})

  7. #7
    Forum Contributor
    Join Date
    07-26-2013
    Location
    Athens, Greece (born and raised in Sydney, Australia)
    MS-Off Ver
    Excel 2010
    Posts
    114
    No, that will return the value 0.5 if F5 is within 0-5 range
    Need to read all info to understand what I need
    Thanks anyway

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Expanding a function

    Quote Originally Posted by John Sio View Post
    If my number on line 5, row F is between the range of 0-5 then the percentage is 50%

    Quote Originally Posted by John Sio View Post
    No, that will return the value 0.5 if F5 is within 0-5 range
    0.5 = 50%

    Simply format the cell as a percent.

  9. #9
    Forum Contributor
    Join Date
    07-26-2013
    Location
    Athens, Greece (born and raised in Sydney, Australia)
    MS-Off Ver
    Excel 2010
    Posts
    114
    I need the value returned in F2 to be = to 50% of 10 for example (ie 5), so that that value can be used as part of a range in functions F3 and F4

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Expanding a function

    Multiply the formula suggested in post #6 by whatever cell that the 10 is in.

    i.e. if the 10 that you are referring to is in A1, the formula would become

    =A1*LOOKUP(F5,{0,6,11},{0.5,0.4,0.3})

    Looking at your first post, it appears that the number (10 in this case) is in F5. Since 10 is between 6 and 11, the multiplication factor would be 40% not 50%.

    Your formula would then be
    =F5*LOOKUP(F5,{0,6,11},{0.5,0.4,0.3})

    Which would evaluate as
    10*0.4
    Last edited by 63falcondude; 06-14-2017 at 10:02 AM.

  11. #11
    Forum Contributor
    Join Date
    07-26-2013
    Location
    Athens, Greece (born and raised in Sydney, Australia)
    MS-Off Ver
    Excel 2010
    Posts
    114
    That's fantastic, works beautiful! Thanks for your help Mr Falcon. Just quickly, would it also work with negative values in F5?

  12. #12
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Expanding a function

    You're welcome. Glad to help.

    You would have to edit the lookup ranges to account for a negative number in F5.

    For example, let's say that you want the following ranges:
    -100 to -60 = 20%
    -60 to -20 = 40%
    -20 to 0 = 60%
    0 to 20 = 80%
    20 to 60 = 85%
    60 to 100 = 90%

    You use the lower value of each range in the formula.
    In this hypothetical case, the vectors in your formula would become {-100,-60,-20,0,20,60} for the lookup vector and {0.2,0.4,0.6,0.8,0.85,0.9} for the result vector.

  13. #13
    Forum Contributor
    Join Date
    07-26-2013
    Location
    Athens, Greece (born and raised in Sydney, Australia)
    MS-Off Ver
    Excel 2010
    Posts
    114
    Ok understood! Thanks again for your very descriptive information which made me understand the whole concept. Cheers

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Expanding a function

    You're welcome. Happy to help!

    If that solved your question, please mark this thread as SOLVED.

+ 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. Expanding COUNTIFS function to add extra criteria
    By stevenpughuk in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 10-25-2016, 11:29 AM
  2. [SOLVED] Expanding a function
    By moomphas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2016, 03:13 AM
  3. Expanding VBA code for greater retrieval function
    By Saeber4777 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-23-2015, 01:37 PM
  4. Expanding Formula
    By cfieser in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-02-2013, 01:33 PM
  5. Replies: 3
    Last Post: 03-08-2013, 01:54 PM
  6. Expanding rows
    By conks in forum Excel General
    Replies: 1
    Last Post: 08-01-2008, 06:14 PM
  7. Expanding field
    By peterbgood in forum Excel General
    Replies: 1
    Last Post: 04-05-2006, 05:15 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