+ Reply to Thread
Results 1 to 5 of 5

more complicated index() / match() function?

  1. #1
    Registered User
    Join Date
    06-23-2004
    Posts
    12

    more complicated index() / match() function?

    Pretend I have an array like this:

    1 2 7 3
    5 3 9 4
    4 10 6 8


    How can I use Excel functions to find the row/col of a number of my choosing? For simplicity's sake, assume all values in the array are unique.

    For example, in cell C1 I type: 2. I want C2 to tell me it's in row 1, column 2. I've tried using Match but I think you can only select a single row/column at a time for that.

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Try the following...

    For the row number:

    =SUMPRODUCT((A1:D3=F1)*(ROW(A1:D3)))

    For the column number:

    =SUMPRODUCT((A1:D3=F1)*(COLUMN(A1:D3)))

    For both row and column number:

    ="Row "&SUMPRODUCT((A1:D3=F1)*(ROW(A1:D3)))&", Column "&SUMPRODUCT((A1:D3=F1)*(COLUMN(A1:D3)))

    ...where F1 contains the number of interest.

    Hope this helps!

    Quote Originally Posted by theillknight
    Pretend I have an array like this:

    1 2 7 3
    5 3 9 4
    4 10 6 8


    How can I use Excel functions to find the row/col of a number of my choosing? For simplicity's sake, assume all values in the array are unique.

    For example, in cell C1 I type: 2. I want C2 to tell me it's in row 1, column 2. I've tried using Match but I think you can only select a single row/column at a time for that.

  3. #3
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256
    Here are 2 alternatives:

    A. Relative position:
    Row: =SUMPRODUCT((C1=A4:C6)*ROW(OFFSET(A1,0,0,ROWS(A4:C6),1)))
    Col: =SUMPRODUCT((C1=A4:C6)*COLUMN(OFFSET(A1,0,0,1,COLUMNS(A4:C6))))
    Test: =INDEX(A4:C6,Row,Col)

    B. Absolute position:
    See Domenic's solution

    Ola Sandstrom


    Note:
    I've excluded all $ for better readability

  4. #4
    Registered User
    Join Date
    06-23-2004
    Posts
    12

    Thanks!

    Thanks very much. That worked out wonderfully.

  5. #5
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256
    Thanks for the feedback.

+ 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