+ Reply to Thread
Results 1 to 5 of 5

IF Function to change Date, on change of cell.

  1. #1
    Registered User
    Join Date
    01-11-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    7

    IF Function to change Date, on change of cell.

    Hi all,

    Got asked to do another spreadsheet macro at work today...*sigh*... Your help is once again needed.

    I've got tens of thousands of data rows.

    It's taking measurements everyday of the year. At 10 minute intervals.
    Problem is, the date reset...So now the data says it goes from 1-01-2010 to 1-01-2004.
    There are time stamps every 10mins of each day too.

    So I was trying to write a macro something like this:


    If Range("Column G") = "00:00" Then Range("Column A") = "2-01-2012".
    End If


    So basically I was trying to write a macro to say when Column G = 00:10 (First measurement after Midnight), advance the previous date (adjacent in column A) by one day.


    Cheers,
    Chris
    Last edited by chrisa112; 02-15-2012 at 10:50 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Another IF Function question

    Forum Rules
    Please read and adhere to these simple rules!

    1. Use concise, accurate thread titles. Your post title should describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change the title of the thread, click EDIT on the original post, then click the Go Advanced button, then change the title. If two or more hours have passed, the EDIT button will not appear, and you need to ask a moderator to change the title.

  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Another IF Function question

    Hi
    why not use functions like Date(), Now(), Time()?

    buran
    If you are pleased with a member's answer then use the Star icon to rate it.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Function to change Date, on change of cell.

    Hi,

    Why bother with a macro when something like

    =IF(AND(G2>0,G2<0.00695),A1+1,A1)

    copied down will do just as easily? Note: Assumes the start date is in A1.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    01-11-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: IF Function to change Date, on change of cell.

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Why bother with a macro when something like

    =IF(AND(G2>0,G2<0.00695),A1+1,A1)

    copied down will do just as easily? Note: Assumes the start date is in A1.

    Regards
    You sir, are a legend!

    Works pefectly.
    I must remember to keep it more simple next time!

    Thanks!!!

+ 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