+ Reply to Thread
Results 1 to 3 of 3

Comparing two columns and return corresponding value if matches

  1. #1
    Registered User
    Join Date
    07-01-2012
    Location
    London
    MS-Off Ver
    Excel 2011
    Posts
    2

    Question Comparing two columns and return corresponding value if matches

    Hello guys,

    I am working on a table, which is like this:

    Column A: Series of time in the format of dd-mm-yyyy hh:mm
    Column B: Series of Reading value reflect at Column A 's time
    Column C: Series of time at 2 minutes interval,

    What I want to do is in Column D, to check every cell in Column C and Column A, If their time match, fill the cell in Column D with the Matched row of Column B, otherwise fill it with zero.

    It is like spreading Column B in to Column D if Column A and C match.

    Attached a excel file where I have started.

    Thanks, any advice please? I have tried Vlookup, Match, but seems difficult to return the corresponding cell when a match found.


    Example.xlsx
    Last edited by jojo3512; 07-02-2012 at 05:42 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Comparing two columns and return corresponding value if matches

    trouble is they don't match for example 07:56 in col a does not match 07:56 in col c
    because col a is 28/06/2012 07:56:00 col c is 28/06/2012 07:56:02 format as dd/mm/yyyy hh:mm:ss look at row 103 down(and btw col c is 1 min intervals not 2)
    right youll never get a match anyway as its due to rounding with excel
    so a work around is to match the text
    see attached,oh and to increment by one minute add 1/24/60
    oh i used =INDEX($C$1:$C$21,MATCH(E1,B:B,0)) you can simply use
    =iferror(INDEX($C$1:$C$21,MATCH(E1,B:B,0)),0) to get 0
    Attached Files Attached Files
    Last edited by martindwilson; 07-02-2012 at 06:23 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    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

  3. #3
    Registered User
    Join Date
    07-01-2012
    Location
    London
    MS-Off Ver
    Excel 2011
    Posts
    2

    Re: Comparing two columns and return corresponding value if matches

    Really appreciate your help on this! Original time in Col A was in hh:mm:ss format, I used Round and Floor to take the second away and them manually created Column C with time format hh:mm, What did wrong was: add 1 to the minute in the A1 and filled the rest as I thought it will increase at 1 minute interval.

    Didn't realise the error.

    Thanks for clearing my doubt, I will double check the true value when comparing columns in the future.!!

+ Reply to Thread

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