If and date functions help needed please

chriscavell

New Member
Joined
Apr 6, 2011
Messages
6
Hi
I know this has been asked somewhere before (I was google searching earlier but cant find it now) but I have a spreadsheet which logs all the invoices my department receives and their relevant pieces of information.
One column, is the current status (ie who has the invoice to sign off and whether it has been approved or not). I want to enter a formula into the 'date sent to accounts' column so that when the current status column says 'yes' the 'date sent to accounts column' automatically enters the date (obviously I don't want this date to change once entered).

I have tried entering an IF statement including the date but cant get it to work.

Can anyone help?

Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You will need code for this. In which column is Yes entered and which column should contain the date?
 
Upvote 0
Hi and welcome to the board!!!

You can use a simple macro for this. Place the following in the Sheet module. RightClick the sheet tab and choose "View Code"
Say your Status Column is "A" and your date column is "B"
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column <> 1 Then Exit Sub    'Column "A" Change as needed
If UCaseP(Target) = "YES" Then Cells(Target.Row, 2) = Date 'Column "B" Change as needed
End Sub

lenze
 
Upvote 0
Hi
The yes column is number 11 and the date column is 13 (off the top of my head I dont have it in front of me at the moment)

Thanks
 
Upvote 0
Make the following changes that are in red
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column <> 11 Then Exit Sub    'Column "A" Change as needed
If UCaseP(Target) = "YES" Then Cells(Target.Row, 13) = Date 'Column "B" Change as needed
End Sub

lenze
 
Upvote 0
Whilst playing with the formula I am occasionally receiving the following message on code screen 'Compile Error: Sub or function not defined' :confused:
 
Upvote 0
I guess I'm a little confused as to what you require!!!
1) What is in Column "K"? How is it entered?
2) What column does the "YES" appear in?
3) What column does the Date go in?

lenze
 
Upvote 0
Column K is the passed for approval column. This is the column which is changed to 'Yes' once an invoice has been approved.

I want the date to go into column N (this is the date when the invoice is sent for payment)

Thanks
Chris
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

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