+ Reply to Thread
Results 1 to 4 of 4

comparing dates and taking appropriate values if there is if not write -9999

  1. #1
    Registered User
    Join Date
    03-09-2012
    Location
    paris,france
    MS-Off Ver
    Excel 2007
    Posts
    16

    comparing dates and taking appropriate values if there is if not write -9999

    Hi,

    I was wondering if someone know how to deal with this topic.

    I have to range of dates, one for instance the regular year and the second one, the same year but with some gaps and data going along with.
    I am looking for a function that will take each date from the full year and searh for the same date in the range with a gaps and then take its coresponding vvalue if that date exists, if not it should write -9999.


    i would really appreciate if someone can help me to resolve this since i have a lot of data like this.


    thank you,
    Attached Files Attached Files

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: comparing dates and taking appropriate values if there is if not write -9999

    Matching dates and times can be a little tricky due to floating point math issues, but this array formula seems to work with your data:

    Please Login or Register  to view this content.
    Confirm as an array formula with Ctrl-Shift-Enter in B2, then autofill down.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: comparing dates and taking appropriate values if there is if not write -9999

    See attached file - you can see the formula that I've used in B2:

    =IFERROR(INDEX(D:D,MATCH(MROUND(A2,1/24),C:C,0)),-9999)

    although it will look different to you with commas changed to semicolons and keyword translated to the French equivalent.

    I also used this formula in E2 temporarily:

    =MROUND(C2,1/24)

    It acts on column C to minimise very small errors which can creep into dates and prevent exact matching. I copied this down, fixed the values, then copied the values into column C to overwrite the values that were there, then deleted the contents of column E.

    Hope this helps.

    Pete
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-09-2012
    Location
    paris,france
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: comparing dates and taking appropriate values if there is if not write -9999

    thanks Pete,

    works perfect.

    cheers!

+ 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. How to write the formula taking active sheet name
    By pranav.y in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-06-2013, 09:50 AM
  2. Tiny macro won't write cell value based on comparing dates
    By Poulan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-10-2010, 12:42 PM
  3. Taking 3 dates and solving for a yes no value
    By Argile79 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-14-2010, 01:58 PM
  4. Taking 3 dates and solving for a yes no value
    By Argile79 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2010, 09:38 PM
  5. Comparing and Copying Values Between Dates
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-19-2010, 07:10 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