+ Reply to Thread
Results 1 to 8 of 8

Need Formula to return the column heading in a table based on a value located in the table

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    3

    Need Formula to return the column heading in a table based on a value located in the table

    I have a table that has 8 columns and 19 rows (including the headings). The columns are 4 regions (with state abbreviations below each) and 4 columns for the number of contracts in each region (with the number of contracts next to the corresponding state).
    I have another sheet with a list of all 50 states, and in the column next to that list, I'd like a formula to pull the corresponding region name from the table. So essentially, it needs to find the state abbreviation location and look upwards rather than down. I've tried combos of index/match as well as some other functions, but can't get it. Also, I've tried to get using an array formula, but I've never really used those and I'm unfamiliar with them. Brief example below with 4 of the 8 columns.

    West Region # Contracts Central Region # Contracts
    BC 1 ND 1
    WA 157 SD 0
    OR 6 NE 0

    Thanks in advance,
    Attached Files Attached Files
    Last edited by gfalcone1; 01-25-2013 at 02:10 PM. Reason: Attachment Included

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Need Formula to return the column heading in a table based on a value located in the t

    An example workbook would be useful

    With INDEX and MATCH you should be able to do what you want
    Click on star (*) below if this helps

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Need Formula to return the column heading in a table based on a value located in the t

    Now attached. Thanks. I know I should be able to!

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

    Re: Need Formula to return the column heading in a table based on a value located in the t

    Are you able to restructure your Table sheet? I would recommend you do so.

    Put ALL the states in one column. In the adjacent column put the corresponding region and in the next adjacent column put the " Contacts.

    Then, you could use a simple VLOOKUP function to get the info you need.

    See if this helps:

    http://contextures.com/xlFunctions02.html
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Need Formula to return the column heading in a table based on a value located in the t

    With current setup, try this in B4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    But Tony is right, it would/will make your formulas a LOT easier if the data was in 1 column rather than 4

    Hope this helps

    Edit-
    The above would have been about 1/6 the size if the data was in single columns
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  6. #6
    Registered User
    Join Date
    01-25-2013
    Location
    Denver
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Need Formula to return the column heading in a table based on a value located in the t

    The formula just about works, I'm trying to follow it to see what's happening. It returns "# of Contracts" for several of the states. I know one column would be easier, I thought about that however it would defeat my purpose of deciding which state should go in which region. Thanks for the input.

  7. #7
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Need Formula to return the column heading in a table based on a value located in the t

    My Bad, left out the "="
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Sorry about that

    However to show what it might look like with Tony's suggestion:gfalcone1.sol1.xlsx
    Column C contains this MUCH easier to use formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See the difference?

    Hope this helps

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

    Re: Need Formula to return the column heading in a table based on a value located in the t

    Try this array formula**:

    =INDEX(Table!$3:$3,MAX(IF(Table!A$4:H$20=A4,COLUMN(Table!A$4:H$20))))

    ** 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 down as needed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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