1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel :: compare 2 columns and get data from 3rd column?

Discussion in 'Business Applications' started by doddatika, Aug 19, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. doddatika

    doddatika Thread Starter

    Joined:
    Aug 19, 2009
    Messages:
    2
    Hi,


    I have an excel sheet with 3 columns. What I want to do is, I need to be able to find value in column 3, that corresponds to a value in column 2. The value in column2 should match the value in col 1.

    Example

    Input Data
    Col1 Col2 Col3
    1------2
    ------A
    2
    ------7------B
    7
    ------1------C
    5
    ------9------D

    The result should be
    Col1 Col2 Col3
    1
    ------1------C
    2
    ------2------A
    7
    ------7------B
    5
    ------9------D


    Please help me.
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,808
    doddatika, welcome to the Forum.
    Sorry, your results data doesn't quite match up with your description.
    I can see that you have re-ordered the data matching up columns 1 & 2, except D has 5 & 9 which don't match up. Does that mean that it will have to wait until a 9 appears in column 1?
     
  3. doddatika

    doddatika Thread Starter

    Joined:
    Aug 19, 2009
    Messages:
    2
    Thanks alot OBP for the response.

    >>I can see that you have re-ordered the data matching up columns 1 & 2, except D has 5 & 9 which don't match up. Does that mean that it will have to wait until a 9 appears in column 1?

    In a way yes.

    Let me be more specific.

    What I plan to do is iterate through each element(cell) in Col 1 look if there is a matching element in col 2. If found I want the data to rearrange as given in the example.

    Now, I have 1 as first element in col1. So I'll search for the element in col2. If found, I have to move elements in both col2(element=1) and col3(element=C) against matching col1

    hence

    1------1------C

    Similarly, the next element in col1 is 2. I'll search for (element=2) in col2. hence,
    2------2------A

    The last element in col1 is (element=5).
    I'll search for (element=5) in col2 and cannot find it hence,
    5------9------D

    So, the unmatched values can be left like that. or as you said, wait till the element is available in col1.
     
  4. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,808
    Ok you need looping VBA vode for that. 2 loops, the first looking at Column 1 and the sceond inside the first looking at column 2.
    can you post an Excel 2003 version of a workbook with a bit of data in it?
     
  5. queenjennie

    queenjennie

    Joined:
    Aug 28, 2009
    Messages:
    1
    Along with this, I have a spreadsheet that I would like to compare one cell with one column. For example if cell A1 says 1234, I would like to know if in column B there are any cells that say 1234. If so, I would like all cell numbers that match cell A1 to be listed in a cell, and if not, could say false or whatever. Any chance that is possible? I would love to know how one goes about learning these things if anyone has suggestions!
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/853589

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice