+ Reply to Thread
Results 1 to 12 of 12

Using two tables to arrive at the correct number

  1. #1
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Using two tables to arrive at the correct number

    Greetings everyone! i hope that someone can help me with this problem.

    here is my problem:

    here is my problem:

    there are two tables listed above. If cell I1 is less than 25 and cell L1 is less than 13 then the index and match should point to table A1:F10
    however, if the cell is 26 or greater and L1 is greater than 13, then the index and match should point to table G4:L10

    on widths 24 and less, the formula that is currently in cell A1 seems to be working properly. I cannot get the formula to pick up the second table when the width is >24

    I have provided data validation in cells I1,J1 and L1 (cell color is dark green). These are the only cells that will\should be manually changed to affect the formula result


    please help!

    thanks in advance for your assistance.

    EXAMPLES TO TRY:
    if cell I1 is 24 and J1 is 30 and L1 is 10 - the formula should point to table 1 and give a result as 385.00
    If cell I1 is 26 and J1 is 30 and L1 is 10 - the formula should point to table 2 and give the result as 530.00


    I have attached a workbook for clarification

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    07-06-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    192

    Re: Using two tables to arrive at the correct number

    There seems to be some mismatch here. you stated If cell I1 is 26 and J1 is 30 and L1 is 10 and the formula should point to table 2 and give the result as 530.00

    But you also mention you wanted to pick up the data from table 2 if cell I1 is >=26 AND L1>13. so how can it work since L1 is 10? =\
    Last edited by finalazy; 02-04-2018 at 12:27 AM.

  3. #3
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: Using two tables to arrive at the correct number

    Sorry for my miscommunication.

    it should have read, table 2 if cell I1 is >=26 AND L1<13.

    sorry for the mix-up.

  4. #4
    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,048

    Re: Using two tables to arrive at the correct number

    Try this...
    =INDEX($B$5:$L$10,MATCH($M$1,$A$5:$A$10,0),MATCH(J1,$B$4:$F$4,0)+IF(I1=26,6,0))
    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

  5. #5
    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,048

    Re: Using two tables to arrive at the correct number

    Quote Originally Posted by darbar76528 View Post
    Sorry for my miscommunication.

    it should have read, table 2 if cell I1 is >=26 AND L1<13.

    sorry for the mix-up.
    revised my formula based on this post...
    =INDEX($B$5:$L$10,MATCH($M$1,$A$5:$A$10,0),MATCH(J1,$B$4:$F$4,0)+IF(AND(I1=26,L1<13),6,0))

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Using two tables to arrive at the correct number

    Formula in O1

    =INDEX(($B$5:$F$10,$H$5:$L$10),L1-6,MATCH(J1,$B$4:$F$4,0),IF(AND(I1<=25,L1<13),1,2))
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  7. #7
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: Using two tables to arrive at the correct number

    Quote Originally Posted by FDibbins View Post
    Try this...
    =INDEX($B$5:$L$10,MATCH($M$1,$A$5:$A$10,0),MATCH(J1,$B$4:$F$4,0)+IF(I1=26,6,0))
    This formula works beautifully! Could you please tell me what the +IF(I1=26,6,0)) represents?

  8. #8
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: Using two tables to arrive at the correct number

    excellent solution! works great. thanks for all your help.

  9. #9
    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,048

    Re: Using two tables to arrive at the correct number

    Quote Originally Posted by darbar76528 View Post
    This formula works beautifully! Could you please tell me what the +IF(I1=26,6,0)) represents?
    You have 2 tables with identical headings. The respective values in the 2nd table are 6 columns away from their counterpart in the 1st table

  10. #10
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: Using two tables to arrive at the correct number

    thanks for the excellent answer! could you however, please explain what the 1,2 represents at the end of the formula? i am trying to wrap my head around this. i cannot figure out how the formula knows which table to use.

    thanks for your trouble in advance!

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Using two tables to arrive at the correct number

    Two tables are given in the beginning of formula .
    If function gives 1 or 2 depending on condition. 1 selects first table similarly for 2 selects second table.

  12. #12
    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,048

    Re: Using two tables to arrive at the correct number

    Happy to help and thanks for the feedback

+ 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. Excel formula to start at one number and arrive at another
    By maxhecht2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-29-2017, 10:06 AM
  2. Replies: 14
    Last Post: 01-26-2017, 03:30 AM
  3. Data tables not returning correct output
    By blaketus17 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-19-2016, 10:56 AM
  4. Replies: 0
    Last Post: 02-16-2016, 05:34 AM
  5. Replies: 1
    Last Post: 09-17-2012, 09:35 AM
  6. Combining two tables together, keeping correct format
    By impala096 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2010, 12:51 PM
  7. [SOLVED] Anyone seen Pivot Tables with incorrect detail but correct total?
    By mickee in forum Excel General
    Replies: 0
    Last Post: 07-17-2006, 03:30 PM

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