Thursday, December 15, 2011

Excel: How do I make a cell show the date of when either of two other cells are filled with information.?

I'm just tring to make my budget book on excell as automated as possible. So on my 'Cash Flow' records sheet I have three forever on-going columns that look like: (Out | In | Date) Out(C) being money spend, In(D) being money obtained, and Date(E) being the date which what ever transaction takes place. I want the 'Date' column to automatically fill in with the current date when either the 'Out or 'In" column is filled with any information.





Right now my formula (in the E column) looks like this:


=IF(AND(C22;D22)=" ";" ";NOW())





This works fine when ever information is entered into C or D, but if the cells are blank, then E show: #VALUE!





And thats where I'm stumped.


Thanks for reading and answering if you can!|||colanth gave you a correct answer to get your formula to work. One problem with your formula is that the Date from your formula will change anytime your sheet calculates values. Even if the values that are calculated are not in columns C and D. So the date for your entries will always be updating each day.





One way around this is to use an event macro (below) instead of your formula.





Right-click on the sheet tab in the lower left


Select View Code


Paste the code below in the VB edit window.





----





Private Sub Worksheet_Change(ByVal Target As Range)


'


If Not Intersect(Target, Range("C:D")) Is Nothing Then


If Target(1).Value %26lt;%26gt; "" Then


Cells(Target(1).Row, "E").Value = Now


Else


Cells(Target(1).Row, "E").Value = vbNullString


End If


End If


End Sub





---|||=IF(AND(ISBLANK(C22),ISBLANK(D22)),"", NOW())|||Forgive the shortness of my answer, but the formula you need is..











=IF((C22%26amp;D22)="","",NOW())

No comments:

Post a Comment