+ Reply to Thread
Results 1 to 6 of 6

Find column title in a range and return the title of THAT column

  1. #1
    Registered User
    Join Date
    05-05-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    4

    Find column title in a range and return the title of THAT column

    Sorry, the title is a disgrace but hopefully the attached data set will make it clearer.
    I have constructed a shift roster (sheet1) where the column titles are the shift types and the row titles are the date of that shift. The content of the table are the names of the people who are working each shift. I want to use this data set to generate a roster in a different format (sheet2). In sheet2, the row titles are still the date of the shift but the column titles are the names of each person. I want each person to be able to just look at their own column and see all there shifts in date order from top to bottom.

    Is there any way to lookup or match the table contents in sheet1 to generate the contents of sheet2? i.e. if I am Laura, cell G7 in sheet2 would search the range D7:L118 in sheet1 for cells containing "Laura" (i.e. G6 in sheet2) for the row in sheet1 matching that particular date (C7) and return the name of the shift I am working on that date (the title of the column where it was found), if any. For G7 in sheet2 it would be "USS" but in G10 in sheet 2 it would be "twilight."

    The practical use of this would be that if I am Laura I can just look down column G on sheet 2 to see all my shifts in order of date.

    I have looked into xlookups, nested if functions and index/match I feel like I need a combination of more than one of those functions and I don't understand them enough!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Find column title in a range and return the title of THAT column

    In D7

    =IFERROR(INDEX(Sheet1!$D$5:$L$5,MATCH(Sheet2!D$6,Sheet1!$D7:$L7,0)),"")

    Copy across and down
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-05-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    4

    Re: Find column title in a range and return the title of THAT column

    Thank you so much!!!

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Find column title in a range and return the title of THAT column

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  5. #5
    Registered User
    Join Date
    05-05-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    4

    Re: Find column title in a range and return the title of THAT column

    I have a follow up question (if that's allowed!). Is there a way to adjust the formula so that it returns an error if I've accidentally put someone down for 2 shifts on the same day? I tried changing to IFNA but that doesn't seem to work!

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Find column title in a range and return the title of THAT column

    In D7

    =IF(COUNTIF(Sheet1!$D7:$L7,Sheet2!D$6)>1, "** ERROR **!",IFERROR(INDEX(Sheet1!$D$5:$L$5,MATCH(Sheet2!D$6,Sheet1!$D7:$L7,0)),""))

    Copy across and down: change warning as required!

+ 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] How to find the column with the max value and return the column title.
    By PaddyP in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2020, 09:14 AM
  2. Replies: 8
    Last Post: 02-07-2019, 05:56 AM
  3. Looking to return column title of second largest value
    By JoJenkins in forum Excel General
    Replies: 1
    Last Post: 02-05-2014, 05:30 PM
  4. Return the Title of a column if the column is the highest column with data
    By williamspage in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-22-2013, 10:05 AM
  5. Find unique number in columns and return column title
    By mkvassh in forum Excel General
    Replies: 3
    Last Post: 10-21-2010, 10:29 AM
  6. Find max value in a row and return column title
    By Jshendel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-21-2006, 12:25 PM
  7. [SOLVED] Named range=Column title,comumn title in cellB6 use B6in equation
    By Graham in forum Excel General
    Replies: 2
    Last Post: 07-21-2006, 05:10 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