+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    11-19-2009
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    2

    lookup in an array

    Hi,

    I need your help in writing a formula that will find a value in an array, based on the labels of the row and column of that value.
    Labels are values in the first row and column of that array, that identifies the looked up cell (at the cross of that row and column).

    Example:

    Density Viscosity Temperature Colour
    Water 0.457 3.55 500 NoColour
    Oil 0.525 3.25 400 Yellow
    Gas 0.616 2.93 300 Black
    Wine 0.675 2.75 250 Red
    Beer 0.746 2.57 200 Green
    Creme 0.835 2.38 150 Wihite

    ex.1:
    Oil (first parameter of the formula)
    Temperature (second parameter of the formula)
    400 (formula needed, based on "Oil" and "Temperature")

    ex.2:
    Wine
    Colour
    Red (formula needed, based on "Wine" and "Colour")

    It seems that is something simple, based on both hlookup and vlookup, but I'm not able to combine that functions....

    Thanks a lot,

    Nick

    PS. Pls check the attached text file for a proper format.
    Attached Files Attached Files
    Last edited by nick61; 11-19-2009 at 08:23 AM.

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: lookup in an array

    If we assume data is listed in A:E headers in row 1 and types in A then

    =INDEX($A:$E;MATCH("Oil";$A:$A;0);MATCH("Temperature"';$1:$1;0))

    obviously constants (Oil, Temp) can be cell references to those cells containing items of interest.

    EDIT:

    Yes you could use VLOOKUP but it will generate greater calculation overheads (dependencies etc) -- INDEX/MATCH generally preferable and certainly more flexible I'd say.

    =VLOOKUP("Oil",A:E,MATCH("Temperature",$1:$1,0),0)
    Last edited by DonkeyOte; 11-19-2009 at 08:35 AM.

  3. #3
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,477

    Re: lookup in an array

    use index with match on row/column
    Attached Files Attached Files
    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: lookup in an array

    Hi Nick,

    Attached is a sample file ...

    HTH
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-19-2009
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: lookup in an array

    Thanks a lot to everyone guys !

    Nick

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0