+ Reply to Thread
Results 1 to 17 of 17

Return Lookup value online if column matches criteria?

  1. #1
    Registered User
    Join Date
    12-19-2017
    Location
    Kentucky
    MS-Off Ver
    2010
    Posts
    7

    Unhappy Return Lookup value online if column matches criteria?

    Title Edit - Return Lookup value *ONLY if column matches criteria?

    I have multiple tabs for each department. Within each tab, I have information that I want to lookup based on column A. This is a simple VLOOKUP. However, because I don't want to have to manually enter all of these formulas for the multiple tabs, I'd like to reference a cell in the tab that will be my column reference for VLOOKUP. Is this possible? If tried SUMIFS but that doesn't seem to work either. Example:

    Dept - 01
    Jan Feb Mar
    VALUE 1
    VALUE 2
    VALUE 3

    My data source for the VLOOKUP has the Dept # for the column header. Each tab is a difference department. Each column of the table will reference a different lookup table. I want my column reference in the VLOOKUP formula to be based on the Dept # (cell A1 in the example).

    I tried SUMIFS but I received an #VALUE error. I think this is because my sum range is more than one column, and my second criteria (dept #) is a row instead of a column.

    HELP?

    *Attached is a sample workbook. Notice in my VLOOKUP my column reference is "2". Since I need to populate about 50 tabs with this information, I would like to reference the Dept # cell and use that as my column reference.
    Attached Files Attached Files
    Last edited by rgunter; 12-19-2017 at 11:27 AM.

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

    Re: Return Lookup value online if column matches criteria?

    Hello and welcome to the forum.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Return Lookup value online if column matches criteria?

    I would create the normal Vlookup formulas, but that can be avoided. You can probably use the INDIRECT function to do what you want.
    The principle is that you build a string to create the reference you want and wrap INDIRECT around the string, and place that in the lookup formula.
    If you need assistance, attach a workbook, with a few examples demonstrating what you want.
    To upload - click GoAdvanced\ look below and click on ManageAttachments, follow screen instructions.
    Thanks
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    12-19-2017
    Location
    Kentucky
    MS-Off Ver
    2010
    Posts
    7

    Re: Return Lookup value online if column matches criteria?

    Quote Originally Posted by kev_ View Post
    I would create the normal Vlookup formulas, but that can be avoided. You can probably use the INDIRECT function to do what you want.
    The principle is that you build a string to create the reference you want and wrap INDIRECT around the string, and place that in the lookup formula.
    If you need assistance, attach a workbook, with a few examples demonstrating what you want.
    To upload - click GoAdvanced\ look below and click on ManageAttachments, follow screen instructions.
    Thanks
    Thank you. I have edited my original post with an attachment.

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

    Re: Return Lookup value online if column matches criteria?

    You only included 2 tabs (worksheets) in your sample.

    Are you saying that you will have multiple Dept tabs (e.g. 'Dept - 01', 'Dept - 02',...) or multiple months tabs (e.g. 'Jan', 'Feb', ...)?

    If you want a single Dept tab and multiple months tabs, is the goal to change cell A1 of the 'Dept - 01' worksheet to "Dept - 02", for example, and have the formula return the corresponding column of the Jan worksheet? If so, shouldn't the 'Dept - 01' worksheet be re-named since it will not always be for Dept - 01?

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

    Re: Return Lookup value online if column matches criteria?

    In B3, copied across and down:

    =IFERROR(INDEX(INDIRECT("'"&B$2&"'!B2:P10"),MATCH($A3,INDIRECT("'"&B$2&"'!A2:A10"),0),MATCH($A$1,INDIRECT("'"&B$2&"'!B1:P1"),0)),"")
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  7. #7
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,294

    Re: Return Lookup value online if column matches criteria?

    Maybe it's okay
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-19-2017
    Location
    Kentucky
    MS-Off Ver
    2010
    Posts
    7

    Re: Return Lookup value online if column matches criteria?

    Quote Originally Posted by 63falcondude View Post
    Are you saying that you will have multiple Dept tabs (e.g. 'Dept - 01', 'Dept - 02',...) or multiple months tabs (e.g. 'Jan', 'Feb', ...)?

    If you want a single Dept tab and multiple months tabs, is the goal to change cell A1 of the 'Dept - 01' worksheet to "Dept - 02", for example, and have the formula return the corresponding column of the Jan worksheet? If so, shouldn't the 'Dept - 01' worksheet be re-named since it will not always be for Dept - 01?
    Both. There are ~50 Dept tabs. Each containing 12 months. You can ignore the months for now, because I can reference a different tab for each month. What I want to do is do all of the formulas for each of these columns, and then copy it into the other tabs. The problem is I will have to change the column reference manually for each tab. What I want is for Excel to look at the Dept # cell in each tab and only return data for that column. My data tab (Jan, Feb, Mar, etc) will have multiple value rows, and each Dept is different. I want to return the relevant data for the row based on the dept #.

  9. #9
    Registered User
    Join Date
    12-19-2017
    Location
    Kentucky
    MS-Off Ver
    2010
    Posts
    7

    Re: Return Lookup value online if column matches criteria?

    Quote Originally Posted by Glenn Kennedy View Post
    In B3, copied across and down:

    =IFERROR(INDEX(INDIRECT("'"&B$2&"'!B2:P10"),MATCH($A3,INDIRECT("'"&B$2&"'!A2:A10"),0),MATCH($A$1,INDIRECT("'"&B$2&"'!B1:P1"),0)),"")
    This works beautifully. Can you explain how this works? This does even MORE than I needed it to. I thought I would have to manually point each column to the correct month tab but this not only looks for the Dept #, it also does the month for me.

  10. #10
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Return Lookup value online if column matches criteria?

    I created 1 more tab for Feb
    In Dept-01, I use CELL function to get the sheet name automatically.
    Cell A1:
    Please Login or Register  to view this content.
    In B3, use INDIRECT:
    Please Login or Register  to view this content.
    Drag down and accross
    Attached Files Attached Files
    Last edited by bebo021999; 12-19-2017 at 12:03 PM.
    Quang PT

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

    Re: Return Lookup value online if column matches criteria?

    It is fundamentally an INDEX-MATCH-MATCH formula.

    The INDEX is the 2D array in which the answer is to be found: the first MATCH returns the row number corresponding to the Value and the second MATCH the column number corresponding to the Department.

    Superimposed into that are a number of INDIRECT functions, which lift the sheet name from row 2 and the Departmnet name from A1. It means that you don't need one sheet fpr every Dept. You can have a nice drop-down in A1 which will enable you to select any department with click of your moose and see the whole year at a glance.

    Do you know how to make a dropdown list for the departments?

    If so, then you're welcome. If not, then ask.




    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

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

    Re: Return Lookup value online if column matches criteria?

    Quote Originally Posted by Glenn Kennedy View Post
    .. with click of your moose and see the whole year at a glance.

    But take care how you click your moose. They can get angry!!!

  13. #13
    Registered User
    Join Date
    12-19-2017
    Location
    Kentucky
    MS-Off Ver
    2010
    Posts
    7

    Re: Return Lookup value online if column matches criteria?

    Quote Originally Posted by Glenn Kennedy View Post
    It is fundamentally an INDEX-MATCH-MATCH formula.

    The INDEX is the 2D array in which the answer is to be found: the first MATCH returns the row number corresponding to the Value and the second MATCH the column number corresponding to the Department.

    Superimposed into that are a number of INDIRECT functions, which lift the sheet name from row 2 and the Departmnet name from A1. It means that you don't need one sheet fpr every Dept. You can have a nice drop-down in A1 which will enable you to select any department with click of your moose and see the whole year at a glance.

    Do you know how to make a dropdown list for the departments?

    If so, then you're welcome. If not, then ask.




    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    I don't think the drop down will work for me. This data ultimately drives another worksheet that needs references to certain department tabs.

    Thanks!

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

    Re: Return Lookup value online if column matches criteria?

    OK. You're welcome anyhow.

  15. #15
    Registered User
    Join Date
    12-19-2017
    Location
    Kentucky
    MS-Off Ver
    2010
    Posts
    7

    Re: Return Lookup value online if column matches criteria?

    Quote Originally Posted by Glenn Kennedy View Post
    OK. You're welcome anyhow.
    OK, once I adapted your formula into my real spreadsheet it doesn't seem to be working. If you don't mind, please look at the updated sample attached. I have moved somethings to make it more relevant to my real spreadsheet. It doesn't appear to be matching the VALUE in column A correctly.

    Thanks,
    Attached Files Attached Files

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

    Re: Return Lookup value online if column matches criteria?

    You have to adjust the ranges to fit your layout.

    Using Glenn's formula:

    B9 =IFERROR(INDEX(INDIRECT("'"&B$8&"'!B7:P19"),MATCH($A9,INDIRECT("'"&B$8&"'!A7:A19"),0),MATCH($A$4,INDIRECT("'"&B$8&"'!B6:P6"),0)),"")

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

    Re: Return Lookup value online if column matches criteria?

    You had scrambled some of the cell references:

    =IFERROR(INDEX(INDIRECT("'"&B$8&"'!B7:P100"),MATCH($A9,INDIRECT("'"&B$8&"'!A7:A100"),0),MATCH($A$4,INDIRECT("'"&B$8&"'!B6:P6"),0)),"")
    Attached Files Attached Files

+ 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] Lookup two column for matches and return largest values from third column
    By abulkhairi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-13-2017, 01:54 AM
  2. [SOLVED] Lookup Values which meet two or more criteria and return multiple matches horizontally
    By josetmg in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-03-2015, 01:16 AM
  3. [SOLVED] Return value from column A where column B value matches a criteria
    By Canther in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-06-2013, 06:23 PM
  4. Lookup from a different column to return sum value if criteria is met.
    By randypang in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-20-2013, 10:49 AM
  5. lookup formula to return data where column header matches
    By tim-harrison in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-06-2013, 12:58 AM
  6. Return last entry in column that matches criteria
    By tomlancaster in forum Excel General
    Replies: 4
    Last Post: 01-22-2010, 10:27 AM
  7. Return Value from 2nd column when value in 1st column matches given criteria
    By Russell_K in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-05-2008, 12:07 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