+ Reply to Thread
Results 1 to 8 of 8

if formula to stop now() code

Hybrid View

  1. #1
    Registered User
    Join Date
    07-01-2010
    Location
    adelaide
    MS-Off Ver
    Excel 2003
    Posts
    86

    if formula to stop now() code

    is there a way that if i have in ..

    A1 - NOW()
    B1 - either open or closed

    if B1 is closed then the time in A1 will stop or become static.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: if formula to stop now() code

    Open or closed what?

  3. #3
    Registered User
    Join Date
    07-01-2010
    Location
    adelaide
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: if formula to stop now() code

    just the text written there

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: if formula to stop now() code

    So if A1=Now() then B1=Closed or B1=Open?
    =if(a1=now(),"Closed","open")
    Placed in B1

  5. #5
    Registered User
    Join Date
    07-01-2010
    Location
    adelaide
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: if formula to stop now() code

    hmm not quite

    i will attach a copy of what i am doing.. IF TIME STOP DOC.
    Attached Files Attached Files

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: if formula to stop now() code

    Maybe

    =IF(B1="Open",NOW(),"")
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: if formula to stop now() code

    This requires VBA.
    Try this
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Target.Count > 1 Then Exit Sub
        If Target.Column <> 11 Then Exit Sub
    
        If Target = "CLOSED" Then
            Target.Offset(0, -3) = Now()
        Else: Target.Offset(0, -3) = "=IF(RC[-1]<>"""",NOW(),"""")"
        End If
    
    End Sub
    And goes into the worksheet module
    Where the modules are
    Attached Files Attached Files

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: if formula to stop now() code

    Possibly


    =IF(B1="Open",NOW(),TEXT(NOW(),"dd-mmm-yy, hh:ss"))

+ 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