+ Reply to Thread
Results 1 to 13 of 13

Lookup value based on specified number sequences

  1. #1
    Registered User
    Join Date
    08-13-2013
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2013
    Posts
    58

    Lookup value based on specified number sequences

    Hello All,

    I need to come up with a formula that will lookup a value in a table based upon a specified number sequence in another table and then add that value to another number/price that corresponds with that specified number sequence.

    In the attached worksheet you will see that there are two groups of tables (A & B). I want to take the prices in group A in columns B:E and then add the values at the top of the page in columns G:J based upon specific numbers to the right of the decimal place in column A under "Rate".

    So in the example at the bottom you will see that the first rate in column A is 5.125. Since the rate ends in .125 then it should be using the value of 2.57 from J2. So it should take the price in B27 (108.328) and add 2.57 to give you 110.898 in M27.

    My problem is that the rate sequence wont always be the same and neither will the values in columns G:J. The only constants are that the rates will end in 1/8ths and the values will be based upon which 1/8ths they end in. For instance; In the example the rate range goes from 5.125 down to 3.75 but sometimes it may be 5.625 down to 4.25.

    Thanks for your help!

    Formula 5-8-14.xlsx

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Lookup value based on specified number sequences

    i have rearranged the table you have in G:J - so that each value is in a cell
    and then used index match to lookup

    this is just for 15days - and probably can be set to you can simply copy across

    =ROUND(INDEX($B$9:$B$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)

    at the moment to do the next column you would need to change the
    =ROUND(INDEX($B$9:$B$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)
    to
    =ROUND(INDEX($C$9:$C$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)

    see if that works for you , then we can change as required

    so in the G:J you can put any decimal part you need
    Attached Files Attached Files
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Lookup value based on specified number sequences

    I tried to do it without changing the data and came up with;
    =B9+INDEX($G$3:$J$3,SUM(($A9=ROUNDDOWN($A9,0)+LEFT($G$2:$J$2,SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4))+SUM(($A9=ROUNDDOWN($A9,0)+RIGHT($G$2:$J$2,LEN($G$2:$J$2)-SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4)))
    as an array formula (confirm with ctrl+shift+enter)in M9 and copy across/down. It works for your example but will assume that your rates headings always have a similar form.

  4. #4
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: Lookup value based on specified number sequences

    Quote Originally Posted by ragulduy View Post
    I tried to do it without changing the data and came up with;
    =B9+INDEX($G$3:$J$3,SUM(($A9=ROUNDDOWN($A9,0)+LEFT($G$2:$J$2,SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4))+SUM(($A9=ROUNDDOWN($A9,0)+RIGHT($G$2:$J$2,LEN($G$2:$J$2)-SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4)))
    as an array formula (confirm with ctrl+shift+enter)in M9 and copy across/down. It works for your example but will assume that your rates headings always have a similar form.
    WOW ragulduy!!!

    Care to explain your formula so that I can learn too!!!

    Why with SUM? As well, what's the *COLUMN($A$1:$D$4) formula does?

  5. #5
    Registered User
    Join Date
    08-13-2013
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2013
    Posts
    58

    Re: Lookup value based on specified number sequences

    Quote Originally Posted by ragulduy View Post
    I tried to do it without changing the data and came up with;
    =B9+INDEX($G$3:$J$3,SUM(($A9=ROUNDDOWN($A9,0)+LEFT($G$2:$J$2,SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4))+SUM(($A9=ROUNDDOWN($A9,0)+RIGHT($G$2:$J$2,LEN($G$2:$J$2)-SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4)))
    as an array formula (confirm with ctrl+shift+enter)in M9 and copy across/down. It works for your example but will assume that your rates headings always have a similar form.
    I tried this and it seemed to work. Can you tell me why this piece is in the formula? COLUMN($A$1:$D$4)

    I'm just trying to learn.

  6. #6
    Registered User
    Join Date
    08-13-2013
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2013
    Posts
    58

    Re: Lookup value based on specified number sequences

    Quote Originally Posted by etaf View Post
    i have rearranged the table you have in G:J - so that each value is in a cell
    and then used index match to lookup

    this is just for 15days - and probably can be set to you can simply copy across

    =ROUND(INDEX($B$9:$B$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)

    at the moment to do the next column you would need to change the
    =ROUND(INDEX($B$9:$B$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)
    to
    =ROUND(INDEX($C$9:$C$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)

    see if that works for you , then we can change as required

    so in the G:J you can put any decimal part you need
    I tried using this and changing the 5.125 rate in A9 to 5.375 and it spit out an error?

  7. #7
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Lookup value based on specified number sequences

    Hi, I would suggest using the formula auditing tool to step through the formula to see what each bit does but to try and explain the logic:
    SEARCH("&",$G$2:$J$2,1)
    will find the position of the & in each of the cells in G2:J2 and return the results as an array of numbers for each cell
    LEFT($G$2:$J$2,SEARCH("&",$G$2:$J$2,1)-1)
    will then return the left hand number in each of the cells as an array
    A9=ROUNDDOWN($A9,0)+LEFT($G$2:$J$2,SEARCH("&",$G$2:$J$2,1)-1))
    will compare the value from the table to the values in the array and return true/false dependant on if they are the same.
    Column($A$1:$D$4) returns the column numbers of A1:D4 as an array (i.e. {1,2,3,4} which are then multipled against the true false results to return the 1 if the G2 is the correct rate, 2 if H2 is the correct rate, 3 if I2 is the correct rate and 4 if J2 is the correct rate.

    I then do the same thing but using the right function to get the second rate in each cell and use the sum() function to get the total of all the different numbers, so if the first number of H2 is the correct rate I would get SUM({0+0,2+0,0+0,0+0}) which =SUM({0,2,0,0}) which = 2, and I then use this with the index function to pick out the correct number to add from the G3:J3 range.

  8. #8
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: Lookup value based on specified number sequences

    Thanks for the explanation ragulduy!

    You mention of formula auditing tool, is that an add-in?

  9. #9
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Lookup value based on specified number sequences

    i'm using L9 to look up and not A9
    =ROUND(INDEX($B$9:$B$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)

    so if in L9 you put =A9 it will work

    or you can change L9 to A9 in the formula

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Lookup value based on specified number sequences

    no, it's part of the "normal" excel.

  11. #11
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Lookup value based on specified number sequences

    Under the Formulas tab there is a button labeled "Evaluate Formula". It's located in the middle on the right half. Select a cell with a formula in it and click that button and you can go through the formula step by step.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  12. #12
    Registered User
    Join Date
    08-13-2013
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2013
    Posts
    58

    Re: Lookup value based on specified number sequences

    Quote Originally Posted by etaf View Post
    i'm using L9 to look up and not A9
    =ROUND(INDEX($B$9:$B$20,MATCH($L9,$A$9:$A$20,0))+HLOOKUP(MOD($L9,1),$L$2:$S$3,2,0),3)

    so if in L9 you put =A9 it will work

    or you can change L9 to A9 in the formula
    Got it. Thanks!

  13. #13
    Registered User
    Join Date
    08-13-2013
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2013
    Posts
    58

    Re: Lookup value based on specified number sequences

    Quote Originally Posted by ragulduy View Post
    I tried to do it without changing the data and came up with;
    =B9+INDEX($G$3:$J$3,SUM(($A9=ROUNDDOWN($A9,0)+LEFT($G$2:$J$2,SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4))+SUM(($A9=ROUNDDOWN($A9,0)+RIGHT($G$2:$J$2,LEN($G$2:$J$2)-SEARCH("&",$G$2:$J$2,1)-1))*COLUMN($A$1:$D$4)))
    as an array formula (confirm with ctrl+shift+enter)in M9 and copy across/down. It works for your example but will assume that your rates headings always have a similar form.

    Thank you so much ragulduy! Its amazing what you can do when you know what you are doing.

+ 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] Continuing Number Sequences with Lines
    By alex.diederich in forum Excel General
    Replies: 27
    Last Post: 04-06-2013, 07:56 AM
  2. Converting number sequences to groups
    By Manar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-28-2013, 06:42 AM
  3. Increasing Number Sequences
    By al888 in forum Excel General
    Replies: 2
    Last Post: 03-15-2011, 12:28 AM
  4. lookup not working with certain number sequences
    By kriminaal in forum Excel General
    Replies: 3
    Last Post: 05-20-2009, 07:01 AM
  5. lookup based on a row number
    By chrisrowe_cr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-15-2005, 10:05 AM

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