+ Reply to Thread
Results 1 to 4 of 4

Search a column for a given cell.

  1. #1
    Registered User
    Join Date
    10-11-2008
    Location
    oslo
    Posts
    2

    Search a column for a given cell.

    Hi.

    I'm trying to get a formula to give a response if a given cell matches any of the values in a row.

    This formula does not work:
    B2=IF(A2=D2:D6;D1;IF(A2=E2:E6;E1;0))

    Spreadsheet:
    see attachment

    I know one solution to the problem but it cannot be the right one...
    B2=IF(OR(A2=D2;A2=D3;A2=D4;A2=D5;A2=D6);D1;....

    I'm using Excel 2007, and it must be a way to easily check one cell up against a row or column. The solution with "OR" statement will be extremely long for a long list, and many columns.

    Tommy
    Attached Images Attached Images
    Last edited by TommyAce; 10-13-2008 at 05:07 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi, and welcome to the forum

    Just use
    =MATCH(yourcell,yourrange,false)

    This will return the position in 'yourrange' that the value is found. If sometimes there may not be any matches and you don't want a #N/A returned, and since you're using 2007, you could wrap the MATCH() function in the new IFERROR() function.

    HTH

  3. #3
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Try one of these:

    =COUNTIF($D$2:$D$6,A2)*$D$1+COUNTIF($E$2:$E$6,A2)*$E$1
    or
    =SUMPRODUCT(($D$2:$E$6=A2)*$D$1:$E$1)

  4. #4
    Registered User
    Join Date
    10-11-2008
    Location
    oslo
    Posts
    2
    Thank you.

    Combining =match() with a =iferror() solved my problem.

    Tommy.

+ 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. cell referenceing
    By demuro1 in forum Excel General
    Replies: 8
    Last Post: 09-26-2008, 04:10 AM
  2. Macro to Search column and if found, copy a cell within the worksheet
    By SKooT1027 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2008, 01:12 PM
  3. Search a range for value and if true put a x in a cell
    By AdRock952 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2008, 07:43 PM
  4. Search for and extract word from a cell
    By hmatharo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-30-2007, 10:21 PM
  5. Search for empty cell, cut and paste
    By celex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2007, 10:32 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