+ Reply to Thread
Results 1 to 11 of 11

Find string in Column A then verify Date in Column B

  1. #1
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Find string in Column A then verify Date in Column B

    Hello,

    I have searched for the answer to this question for hours and cannot seem to find what I need. I am looking for what seems so simple, I am searching for a string in Column A and simply want to verify the date in Column B.

    Here is what I am using for code to search:
    Please Login or Register  to view this content.
    I have no clue how to add looking at ColumnB to check for the date once the string has been found in Column A.


    I posted a similar question here:
    http://www.excelforum.com/excel-prog...html?p=3009815

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find string in Column A then verify Date in Column B

    Try something like this (based on your original question)...

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Find string in Column A then verify Date in Column B

    AlphaFrog

    Thanks VERY much for the help, I can't thank you enough for your time. I think this is PERFECT for what I need. One question about this code.... What will tell me exactly when the 6 month marker from today has been reached? Such as 6 months and 1 day.

  4. #4
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Find string in Column A then verify Date in Column B

    I should clarify that... How to tell 6 months & 1 day ago.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find string in Column A then verify Date in Column B

    DateAdd("m", -6, Date)

    Date is today's date.
    The DateAdd function subtracts six months from today's date.
    That calculated date is compared to the Historical Record date.

  6. #6
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Find string in Column A then verify Date in Column B

    Ok, I think I got it now... The only other question I have about the History Record is, If I end up with 3 matches with different dates, how can be sure it would find the last one in the column?

    For example, I might have in history:

    Column A (searched) Column G (date)

    PMC104 1/13/2012
    PMC104 5/1/2012
    PMC104 8/1/2012

    How can I check to make sure it finds the most recent date and doesn't just look at 1/13/2012 and accept that? Or find the last one in Column A since the history record will be oldest at the top.
    Last edited by Nu2Java; 11-17-2012 at 06:00 PM.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find string in Column A then verify Date in Column B

    Good point. This will return the last match in the column.

    Set Found = Sheets("Historical Record").Range("A:A").Find(strFind, , , xlWhole, , xlPrevious, False)

    Here's a primer on the .Find method.

  8. #8
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Find string in Column A then verify Date in Column B

    I gave this a try and the msgbox did not trigger. I used a PMC104 at the top with a date of 2/1/2012 and then a PMC104 about 8 lines down with 7/1/2012.

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find string in Column A then verify Date in Column B

    It worked for me.

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Find string in Column A then verify Date in Column B

    Thanks, I think I got it..... I have no idea what I did wrong, but it's working now. Thanks for your help! Greatly appreciated.

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Find string in Column A then verify Date in Column B

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    have you considered thanking those who have helped you? click the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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