+ Reply to Thread
Results 1 to 5 of 5

Return a column header based on text in a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    07-11-2016
    Location
    Gainesville, FL
    MS-Off Ver
    Office 2016
    Posts
    4

    Return a column header based on text in a cell

    Hi,

    So I usually suck at explaining things, but I've googled this to death and I'm desperate, so here goes.

    I have huge amount of data from a survey in an excel spreadsheet. The column headers are the labeled with the question numbers of the survey (Q1, Q2, Q3, so on). Each row has the name of the survey taker and the subsequent answers to the questions. For each individual survey taker, I need to know which questions they answered negatively. For example, if I have

    Name Q1 Q2 Q3
    John Doe Strongly Disagree Disagree Agree

    Is there a way to use a formula or table to tell me that John Doe answered Q1 & Q2 "negatively" (with negatively being defined as somewhat disagree, disagree, or strongly disagree)?

    Basically I want to find all the somewhat disagree, disagree, or strongly disagree answers in each row and return the column header of each cell that has any three of those values in it.

    Hopefully I was clear enough to understand D:

    Thanks!
    Attached Files Attached Files
    Last edited by sdeel1; 08-03-2016 at 06:57 PM. Reason: would not let me attach a sample before - adding one now

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,824

    Re: Return a column header based on text in a cell

    It would help if you attached a sample Excel workbook. To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Pete

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Return a column header based on text in a cell

    Try this...

    Data Range
    A
    B
    C
    D
    E
    1
    Q1
    Q2
    Q3
    Q4
    2
    Sam
    Agree
    Agree
    Agree
    Disagree
    3
    Pam
    Somewhat Disagree
    Agree
    Strongly disagree
    Agree
    4
    Mam
    Agree
    Strongly Disagree
    Agree
    Disagree
    5
    6
    7
    Pam
    Q1
    Q3
    8


    This array formula** entered in B7:

    =IFERROR(INDEX(1:1,SMALL(IF(ISNUMBER(SEARCH("Dis",INDEX($B2:$E4,MATCH($A7,$A2:$A4,0),0))),COLUMN($B2:$E4)),COLUMNS($B7:B7))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy across until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    07-11-2016
    Location
    Gainesville, FL
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: Return a column header based on text in a cell

    thanks for all the help ya'll!

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Return a column header based on text in a cell

    You're welcome!

+ 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. macro to lock cell by column header based on value in another cell by column header
    By Closet Guru in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2015, 12:36 PM
  2. Return column header based on column criteria and number value
    By bwill22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2014, 07:33 PM
  3. Replies: 1
    Last Post: 01-30-2014, 01:42 PM
  4. [SOLVED] Return Value from column based on header value
    By SAsplin in forum Excel General
    Replies: 5
    Last Post: 07-16-2013, 07:46 AM
  5. [SOLVED] Return header column text if value in row below
    By Adrian W in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-20-2012, 09:05 PM
  6. [SOLVED] Trying to return a column header in a cell based on a value
    By brianfromla in forum Excel General
    Replies: 2
    Last Post: 06-26-2012, 10:37 AM
  7. [SOLVED] find the highest text value in a row, and return the corresponding column header
    By bumbling-idiot in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-09-2012, 07:09 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