Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default input date as date in formula

I want to place a "C" for canceled in a certain column, and based on the date that the "C" was entered, establish the status for the contract. For example, if it was entered today()-7, it would be a "New Cancellation", else "Canceled"

Is this possible?

TIA,
Jill.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default input date as date in formula

Thanks for your response!

I was actually looking for the vba code to calculate from the date the "C" was entered into the column. I didn't want the user to have to input the date, rather for Excel to calculate it automatically.

Thanks!

Jill.

"sebastienm" wrote:

Hi Jill
1. Data Entry
Do you need help on the Status formula or on the data entry too?
For data entry:
Would the user enter both the C and the date when the C was entered?
If you want the date to be entered automatically, you need vba code

2. Status formula
Assuming C is entered in column A, the date in column B.
For the status, assuming row 2:
=IF( C2="C" , IF( (Today()-B2)<7 , "New Cancel", "Old Cancel") , "No Cancel")
or based on how you column B2 is formatted, maybe use the Datavalue() function:
=IF( C2="C" , IF( (Today()-B2)<7 , "New Cancel", "Old Cancel") , "No Cancel")

--
Regards,
Sébastien

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default input date as date in formula

Hi Jill,
The following event macro has to be placed in the corresponding sheet code module.
It assumes the C is entered in column rgSEntry (here, A:A. If not, change the Set RgSEntry line).
Anytime a cell is changed in column rgSEntry (A:A), it writes the current date to the cell on its right (here, B:B).

'-------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rgSEntry As Range
Dim Rg As Range
Dim cell As Range

Set rgSEntry = Range("A:A") '<---- change here
'column where the C is placed

Application.EnableEvents = False
Set Rg = Application.Intersect(rgSEntry, Target)
If Not Rg Is Nothing Then
Rg.Offset(0, 1).Value = Date 'Write data one column on the right
End If
Application.EnableEvents = True
End Sub
'------------------------------------------------------------------
--
Regards,
Sébastien

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default input date as date in formula

ok... since you did such a great job helping me with that problem... to take it a step further...

when i delete the "C," the date in the adjacent column remains. how do i delete that date automatically if the "C" is deleted?

thanks!

jill.

"sebastienm" wrote:

Hi Jill,
The following event macro has to be placed in the corresponding sheet code module.
It assumes the C is entered in column rgSEntry (here, A:A. If not, change the Set RgSEntry line).
Anytime a cell is changed in column rgSEntry (A:A), it writes the current date to the cell on its right (here, B:B).

'-------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rgSEntry As Range
Dim Rg As Range
Dim cell As Range

Set rgSEntry = Range("A:A") '<---- change here
'column where the C is placed

Application.EnableEvents = False
Set Rg = Application.Intersect(rgSEntry, Target)
If Not Rg Is Nothing Then
Rg.Offset(0, 1).Value = Date 'Write data one column on the right
End If
Application.EnableEvents = True
End Sub
'------------------------------------------------------------------
--
Regards,
Sébastien

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default input date as date in formula

since you helped me so graciously... i wonder if i could take it a step further...

when i delete the "C," the date in the adjacent column remains. how would i delete that date automatically if the "C" is deleted?

thanks!

jill.

"sebastienm" wrote:

Hi Jill,
The following event macro has to be placed in the corresponding sheet code module.
It assumes the C is entered in column rgSEntry (here, A:A. If not, change the Set RgSEntry line).
Anytime a cell is changed in column rgSEntry (A:A), it writes the current date to the cell on its right (here, B:B).

'-------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rgSEntry As Range
Dim Rg As Range
Dim cell As Range

Set rgSEntry = Range("A:A") '<---- change here
'column where the C is placed

Application.EnableEvents = False
Set Rg = Application.Intersect(rgSEntry, Target)
If Not Rg Is Nothing Then
Rg.Offset(0, 1).Value = Date 'Write data one column on the right
End If
Application.EnableEvents = True
End Sub
'------------------------------------------------------------------
--
Regards,
Sébastien

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How input today's date and keep that date tjsmags Excel Worksheet Functions 3 December 30th 07 10:17 PM
input a date or update it based on date in another cell Doug P New Users to Excel 1 July 18th 07 11:25 PM
Create a formula in a date range to locate a specific date - ecel util Excel Discussion (Misc queries) 0 February 19th 07 03:03 PM
date input Paul M. Excel Discussion (Misc queries) 2 April 21st 06 07:14 PM
how do i make a cell date sensitive to execute a formula or input. ebuzz13 Excel Discussion (Misc queries) 2 January 20th 05 08:33 PM


All times are GMT +1. The time now is 11:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"