+ Reply to Thread
Results 1 to 13 of 13

Finding cell location of a value in a multi column array

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    Montara, California, US
    MS-Off Ver
    Excel 2007
    Posts
    16

    Finding cell location of a value in a multi column array

    I need to find a solution using Function and not code. In an array of multiple columns each with multiple rows of values, I need to find the location/cell of a value so that I can retrieve the column heading.

    As a small example below if I have value C3, I want to find that the value is in column 3 row 3 of the array so I can extract heading Y. But if a value K9 is searched for it needs to results in an error

    W X Y Z
    A1 B1 C1 D1
    A2 B2 C2 D2
    A3 B3 C3 D3
    A4 B4 C4 D4

    I have tried 'Match' but that only works on a single column array. 'Lookup' will provide a heading but it will also provide a heading even if the value isn't found.

    Any suggestions would be appreciated. Thank you

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Finding cell location of a value in a multi column array

    Are you able to provide more details on the nature of the data?

    Is your data literally letters and numbers, incrementing by one letter across columns and up numbers by row?

    If so, I'd use SUBSTITUTE to break the letter from the numeral, match across rows to find the header.

    If not, you should probably take a couple of minutes to put a sample together.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Finding cell location of a value in a multi column array

    You can try this..

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where Header like A1:D1
    and data like A2:D10
    SearchVal = C3
    Search Match.xlsx

    EDIT:
    PS.. will show #NA in case of multiple searchVal found..
    Last edited by Debraj Roy; 12-18-2013 at 07:12 PM.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Finding cell location of a value in a multi column array

    If you can use a helper row, it will make things simpler. See below, I used row 6...
    V
    W
    X
    Y
    Z
    1
    W X Y Z
    2
    C3 A1 B1 C1 D1
    3
    Y A2 B2 C2 D2
    4
    A3 B3 C3 D3
    5
    A4 B4 C4 D4
    6
    0
    0
    1
    0


    In W6:Z6...
    =COUNTIF(W2:W5,$V$2) copied across
    Then in V3...
    =INDEX($W$1:$Z$1,MATCH(1,$W$6:$Z$6,0))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Finding cell location of a value in a multi column array

    @ Debraj, nice formula You may need to explain about the range names though?

  6. #6
    Forum Contributor
    Join Date
    05-07-2013
    Location
    apple valley ca
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: Finding cell location of a value in a multi column array

    something like this???
    i think i got what you want
    Attached Files Attached Files

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

    Re: Finding cell location of a value in a multi column array

    Here's another one....

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    W
    X
    Y
    Z
    ----
    C3
    Y
    2
    A1
    B1
    C1
    D1
    3
    A2
    B2
    C2
    D2
    4
    A3
    B3
    C3
    D3
    5
    A4
    B4
    C4
    D4

    This array formula** entered in G1:

    =INDEX(A1:D1,1/(1/MAX(IF(A2:D5=F1,COLUMN(A2:D5)-COLUMN(A2)+1))))

    ** 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.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Registered User
    Join Date
    04-16-2013
    Location
    Montara, California, US
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Finding cell location of a value in a multi column array

    Thank you Ford the combination of Countif and Index with helper row lets me pull the header for the value entered. The values are long text but I used A1 etc to make the example easier to read.

    Just in case you could help again, my next challenge is that the real table I have is actually 10 columns with 100 rows maximum but each column has less than 100 text values. I have to combine all values into 1 column to be used in a data validation so I need to eliminate all the blank cells in that combination. Using my array of values below I would need to build a column with A1, B1, B2, B3, C1, D1, D2 to present for data validation and whatever value is selected I would use your earlier help to present them with the heading.

    A1 B1 C1 D1
    B2 D2
    B3

  9. #9
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Finding cell location of a value in a multi column array

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

    Please start new thread if it not related to this query..

  10. #10
    Registered User
    Join Date
    04-16-2013
    Location
    Montara, California, US
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Finding cell location of a value in a multi column array

    Thank you Tony for an alternave 2 way to get results

    Bob Ptacek

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

    Re: Finding cell location of a value in a multi column array

    You're welcome. Thanks for the feedback!

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Finding cell location of a value in a multi column array

    You have shown what your sample data looks like...
    A1 B1 C1 D1
    B2 D2
    B3
    What would your end result look like?

  13. #13
    Registered User
    Join Date
    04-16-2013
    Location
    Montara, California, US
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Finding cell location of a value in a multi column array

    Quote Originally Posted by FDibbins View Post
    You have shown what your sample data looks like...


    What would your end result look like?

    Unfortunatly the copy of the samle didn't line up right. It was to be 4 columns. First with 1 A, 2nd with 3 Bs 3rd with 1 C and 4th with 2 Ds. The column I need to build from that array would have the values A1, B1, B2, B3, C1, D1, D2. So that after A1 when a blank cell is encountered, the functions need to move to teh next column in the array. With offset, indirect, index etc I can go through the array but I take teh blanks with me. What I'm building is a column to be used in data validation and I need to get eh blanks out.

+ 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. How to extend a changing multi cell array formula down a column.
    By Patrician in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-12-2013, 07:07 PM
  2. Replies: 5
    Last Post: 09-12-2012, 01:27 PM
  3. Replies: 2
    Last Post: 12-09-2011, 02:49 PM
  4. Single Conditional Array x two Multi-Column Array - Approach needed
    By David Brown in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-28-2010, 11:41 AM
  5. Finding the last populated cell in a column array
    By JosephJames in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-18-2009, 12:42 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