+ Reply to Thread
Results 1 to 5 of 5

Comparing a Cell to a column

  1. #1
    Registered User
    Join Date
    10-27-2015
    Location
    Montreal, Canada
    MS-Off Ver
    2015
    Posts
    2

    Comparing a Cell to a column

    Hey!

    I am looking to do this trickery with excel, but I have hit a wall!

    I have 5 column

    Column two has multiple cells with the same number as column one (they are on different sheets)

    I want to find any match for the first cell (A2 in this case) in the 2nd column. Than, if they match, I want to compare the 3rd column to a another cell. If they match again, I want to copy the cell from column 4 into column 5

    My first attempt was to use =If(And(...)) but it will only check for the same row. (If row 6 match row 2, it won't show up, but if it match row it workd perfectly)

    Anyone knows a way to work this out?

    Thanks!

    Edit:
    Attached Exemple! Thanks for below
    I've put color to help figure out where the number come from!

    exemple.xlsx
    Last edited by madnewmy; 10-27-2015 at 04:21 PM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Comparing a Cell to a column

    You get better help on your question if you add a small excel file, without confidential information.

    Please also add manualy the expected result in your file.

    To Attach a File:

    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Comparing a Cell to a column

    Using your sample sheet, enter 10 into G1, then enter this formula into G2

    =IFERROR(INDEX($D$2:$D$19,MATCH(TRUE,IF($B$2:$B$19=$A2,($C$2:$C$19=G$1)),0)),0)

    *** Note that this is an array formula which must be confirmed using Shift Ctrl and Enter, not just Enter ***

    Copy the formula down as needed.

  4. #4
    Registered User
    Join Date
    10-27-2015
    Location
    Montreal, Canada
    MS-Off Ver
    2015
    Posts
    2

    Re: Comparing a Cell to a column

    Thanks a lot it worked out!

    If you have a few mins, could you explain to me why this works out? Worst case I'll figure it out eventually!

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Comparing a Cell to a column

    This part of the formula effectively creates an 'AND()' condition for each row

    IF($B$2:$B$19=$A2,($C$2:$C$19=G$1))

    So is basically the same as writing IF(AND(B2=A2,C2=G1),D2,IF(AND(B3=A2,C3=G1),D3,etc...

    MATCH finds the first row where both parts are TRUE, and INDEX returns the result. IFERROR is used to suppress any non matching pairs and return a 0 result.

+ 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. Replies: 2
    Last Post: 06-23-2015, 08:29 AM
  2. Excel - VBA Comparing cell values to each column's average
    By Joseph1220 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2014, 02:01 PM
  3. Formula Help Needed Please!!Comparing a cell to a column
    By jgkinder in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2013, 06:15 PM
  4. Comparing one cell to a column of cells
    By dlanza in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-26-2012, 02:00 PM
  5. Replies: 3
    Last Post: 04-06-2011, 01:15 PM
  6. Comparing one cell to an entire column (SOLVED)
    By knitterkuba in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-26-2010, 03:12 PM
  7. comparing a column of cell and then copy info
    By Kelly******** in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2006, 07:15 PM

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.6.0 RC 1