Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
calculate date diff in a cell
Hi.
I have a spread sheet that contains in the first column a date time formatted field, in a few columns over, I have a field that I would like to automatically calculate the days between the current rows date field and the previous rows date field and put the number of days different in the days diff column. Can anyone help me with this...? Thanks, Brian Shafer |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
calculate date diff in a cell
Brian,
If I understand you correctly (and I probably don't) in a1 you have a value: 2006/01/01 in a2 you have a value: 2006/01/03 in b2 for days difference: =A2-A1 Robin Hammond www.enhanceddatasystems.com "Brian Shafer" wrote in message ... Hi. I have a spread sheet that contains in the first column a date time formatted field, in a few columns over, I have a field that I would like to automatically calculate the days between the current rows date field and the previous rows date field and put the number of days different in the days diff column. Can anyone help me with this...? Thanks, Brian Shafer |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
calculate date diff in a cell
yes, you are right.. but I want it to happen automatically when I enter a
valid date in t b1 write the diff in b2 "Robin Hammond" wrote in message ... Brian, If I understand you correctly (and I probably don't) in a1 you have a value: 2006/01/01 in a2 you have a value: 2006/01/03 in b2 for days difference: =A2-A1 Robin Hammond www.enhanceddatasystems.com "Brian Shafer" wrote in message ... Hi. I have a spread sheet that contains in the first column a date time formatted field, in a few columns over, I have a field that I would like to automatically calculate the days between the current rows date field and the previous rows date field and put the number of days different in the days diff column. Can anyone help me with this...? Thanks, Brian Shafer |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
calculate date diff in a cell
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:H10" On Error GoTo ws_exit: Application.EnableEvents = False If Target.Row = 1 And Target.Column 1 Then With Target .Offset(1, 0).Value = .Value - .Offset(0, -1).Value End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Brian Shafer" wrote in message ... yes, you are right.. but I want it to happen automatically when I enter a valid date in t b1 write the diff in b2 "Robin Hammond" wrote in message ... Brian, If I understand you correctly (and I probably don't) in a1 you have a value: 2006/01/01 in a2 you have a value: 2006/01/03 in b2 for days difference: =A2-A1 Robin Hammond www.enhanceddatasystems.com "Brian Shafer" wrote in message ... Hi. I have a spread sheet that contains in the first column a date time formatted field, in a few columns over, I have a field that I would like to automatically calculate the days between the current rows date field and the previous rows date field and put the number of days different in the days diff column. Can anyone help me with this...? Thanks, Brian Shafer |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
calculate date diff in a cell
Awesome... Thanks
"Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "A1:H10" On Error GoTo ws_exit: Application.EnableEvents = False If Target.Row = 1 And Target.Column 1 Then With Target .Offset(1, 0).Value = .Value - .Offset(0, -1).Value End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Brian Shafer" wrote in message ... yes, you are right.. but I want it to happen automatically when I enter a valid date in t b1 write the diff in b2 "Robin Hammond" wrote in message ... Brian, If I understand you correctly (and I probably don't) in a1 you have a value: 2006/01/01 in a2 you have a value: 2006/01/03 in b2 for days difference: =A2-A1 Robin Hammond www.enhanceddatasystems.com "Brian Shafer" wrote in message ... Hi. I have a spread sheet that contains in the first column a date time formatted field, in a few columns over, I have a field that I would like to automatically calculate the days between the current rows date field and the previous rows date field and put the number of days different in the days diff column. Can anyone help me with this...? Thanks, Brian Shafer |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculate diff. between 2 times | Excel Worksheet Functions | |||
aps3 calculate diff in time and cinvert into another format | Excel Worksheet Functions | |||
formula to calculate future date from date in cell plus days | Excel Worksheet Functions | |||
Calculate month-end date from date in adjacent cell? | Excel Worksheet Functions |