+ Reply to Thread
Results 1 to 9 of 9

VLOOKUP with named columns, need to match the name based on first row

  1. #1
    Forum Contributor
    Join Date
    09-05-2019
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 365
    Posts
    101

    VLOOKUP with named columns, need to match the name based on first row

    Hello

    I have a set of data that have timestamp, temperature, and RH. Each of the temperature/RH group corresponds to a specific area, where it is labelled as "Area1". In my sampledata3 attached, this is under the tab "rawdata"

    I have a series of survey respondents and I have already been able to tell that Person A sits at Area1, Person B sits at Area2, and so forth. In addition, the timestamps of the survey respondents have been rounded to the neart 15-minute timestamp, which would match my rawdata timestamp. I need to lookup the temperature/RH in the rawdata tab based on the specific timestamp of the survey responden and place it accordingly in the "timestamp_data" tab.

    While it might be simple to do a VLOOKUP based on the specific column, the twist (not to sure if it is a twist) that I have is that in the "rawdata" tab, I have named the selected columns so I can get better titling and groupings (ex: Area1_temp), but I was wondering if there is a way to do a VLOOKUP based on the corresponding "title" and get the correct column. Or do I have to do some prework on the the "rawdata" tab, such as grouping the like information together.

    Thanks
    Attached Files Attached Files
    Last edited by dcwan; 09-17-2019 at 01:55 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: VLOOKUP with named columns, need to match the name before the undersore

    You can use MATCH function to identify the col_index_num for VLOOKUP function.
    I assume that the area name on the first row of rawdata worksheet match with the area name in column B of timestamp_data worksheet (Area2 instead of Area2_Temp and Area3 instead of Area3_Temp). In that case, you can try below formulas.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    ❖ Please mark your thread is SOLVED if there has been offered a solution that works fine for you.

    ❖ If you like solutions provided by anyone, feel free to add reputation by clicking on ✶ Add Reputation bottom left of their posts.

  3. #3
    Forum Contributor
    Join Date
    09-05-2019
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 365
    Posts
    101

    Re: VLOOKUP with named columns, need to match the name before the undersore

    This works for the sample data. Will try it out and see how I can scale it for my actual data.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: VLOOKUP with named columns, need to match the name based on first row

    I have not examined huuthang_bd's solution yet. I was busy working on another approach.

    If I follow your intent correctly I believe HLOOKUP works also. Though your thread is marked Solved I offer this:

    In C2:C5
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In D2:D5
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  5. #5
    Forum Contributor
    Join Date
    09-05-2019
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 365
    Posts
    101

    Re: VLOOKUP with named columns, need to match the name based on first row

    Quote Originally Posted by FlameRetired View Post
    ...

    In C2:C5
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In D2:D5
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This also looks nice. Is it possible to replace wildcard with "temperature" for the first one, and "RH" for the second one? Would this work as well?

    I was wondering if I could expand this usage to other things, because I might have more than one column in the rawdata in the future.

    Thanks

  6. #6
    Forum Contributor
    Join Date
    09-05-2019
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 365
    Posts
    101

    Re: VLOOKUP with named columns, need to match the name based on first row

    Also, is there anyway to simplify the formula. Instead of writing "rawdata!B$1...", is there a simpler way to reference the whole table?

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: VLOOKUP with named columns, need to match the name based on first row

    Edited to include upload.

    Your workbook already had the Table name 'sampledata'. I used that in this formula.

    I also changed "Temperature" in the timestamp_data sheet to agree with 'sampledata' headers.

    Use this in C2. Fill down and across to D5. It is wildcard free and references the structured Table names.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 09-17-2019 at 06:39 PM.

  8. #8
    Forum Contributor
    Join Date
    09-05-2019
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 365
    Posts
    101

    Re: VLOOKUP with named columns, need to match the name based on first row

    This is great. Thanks for your help

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: VLOOKUP with named columns, need to match the name based on first row

    You are welcome. Glad to help. Thank you for the feedback and added rep.

+ 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. Vlookup on merged cells (row and column)
    By PTVC in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2019, 02:42 AM
  2. Vlookup help when referencing poorly formatted raw data and merged cells
    By Mrmarc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-18-2017, 04:08 AM
  3. Replies: 2
    Last Post: 01-16-2016, 02:31 PM
  4. Replies: 4
    Last Post: 03-11-2015, 08:46 AM
  5. [SOLVED] Can you sort & expand column data when cells are merged?
    By lsargent in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-27-2013, 06:37 PM
  6. [SOLVED] Split Merged Data from one column in to 3
    By Trig79 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-22-2012, 02:21 AM
  7. Excel 2007 : Vlookup help with merged cell data.
    By here.to.code in forum Excel General
    Replies: 3
    Last Post: 02-17-2011, 10:25 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