Replacing Formula in a Cell With the Value after the date has passed...

largeneed

New Member
Joined
Sep 14, 2017
Messages
2
Hi everyone,

Is there a way to change a cell to a value of a formula that was calculated but only for certain cells, and after the date has passed.

Here is the formula in a cell that I want to change to just the value :



=(COUNTIFS('Decision Tracking'!H:H,A7,'Decision Tracking'!I:I,""))

Which currently gives a value of 1

A7 in this case is today's date which is September 14, 2017.

So when it is tomorrow, I want the cell above to have just the result value of 1, and not have the formula.

Is this possible in excel ?

Will I have to use macro ?

Right now I'm just doing it manually at the end of each day . (Entering the result of the formula, and just putting the value in that cell.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Yes this is possible. Yes you will need to use a macro. You'll most likely need to store some kind of criteria in a cell or a custom document property... I would consider an Event Procedure or a WorkBook Open Procedure.

Code:
Sub Test()
    If Date > "Cell with Previous Date? or some other criteria" Then
        Range("A7") = Range("A7")
    End If
End Sub

Would need more detail to help with your exact issue.
 
Last edited:
Upvote 0
Yes this is possible. Yes you will need to use a macro. You'll most likely need to store some kind of criteria in a cell or a custom document property... I would consider an Event Procedure or a WorkBook Open Procedure.

Code:
Sub Test()
    If Date > "Cell with Previous Date? or some other criteria" Then
        Range("A7") = Range("A7")
    End If
End Sub

Would need more detail to help with your exact issue.

Hi Thank you so much for replying.

I don't know what a workbook open procedure is, but I can answer your other questions.

Code:
Sub Test()
    If Date > "Not yesterday, and not today (should only apply to yesterday's cells" Then
        Range("A7") = Range("A7")
    End If
End Sub

Here is how column A is setup:

A
row 7 - 14-Sep-17
row 8 - 15-Sep-17
row 9 -18-Sep-17
row 10 - 19-Sep-17

The date is populated by the formula: =WORKDAY(A6,1)

<colgroup><col></colgroup><tbody>
</tbody>

Where a6 is the previous day.

So to recap, once it is tomorrow, the cell which contains this formula:

=(COUNTIFS('Decision Tracking'!H:H,A7,'Decision Tracking'!I:I,""))

Should then be only the value that the formula calculated on Sept 14, 2017, which in this case is 1.

I will research workbook procedure's today when I get home. Thank you again!
 
Upvote 0
What column is your formula in? Should be something like this:

Code:
Private Sub Workbook_Open()
    Dim strtRow As Integer
    Dim LRow As Integer
    Dim intLp As Integer
    
    'The row we want to start at....
    strtRow = 7
    'Define the last row in column A
    LRow = Range("A" & Rows.Count).End(xlUp).Row
    
    For intLp = strtRow To LRow
        If Range("A" & intLp) = Date - 1 Then
            Range("YOUR FORMULA CELL RANGE HERE") = Range("YOUR FORMULA CELL RANGE HERE")
            Exit For
        End If
    Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,069
Messages
6,128,600
Members
449,460
Latest member
jgharbawi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top