IF Date = This then enter this number

Church

New Member
Joined
Oct 8, 2002
Messages
2
First time post and am impressed (and dwarfed) by the knowledge floating around out there. I'm in the right place for this easy question. Would like to be able to have a cell calculate the system date between a range (ie 10/01/02 and 10/31/02) and if the current date falls within that range the cell value would input a number from another cell? After the date range is pasted (ie 11/01/02) the number in the cell would remain as it was on the last day.

I have Simply in cell P27 the formula =SUM(P25:P26) and it equals say 25.

IF today is 10/8/02 then cell O33 would get the number 25 input into it.

A coworkers attempts have brought this formula (that doesn't work):

=IF(TODAY()<DATE(2002,11,1),O33=P27,O33=O33)


_________________
David L. Churchill, MSgt, MNANG
Network Administrator
david.churchill@mndulu.ang.af.mil
Comm: (218) 788-7897
FAX: (218) 788-7457
"Experience... is simply the name we give to our mistakes."
||||| /
/ [_]
(-) (
This message was edited by Juan Pablo G. on 2002-10-09 17:07
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
On 2002-10-09 17:02, Church wrote:
First time post and am impressed (and dwarfed) by the knowledge floating around out there. I'm in the right place for this easy question. Would like to be able to have a cell calculate the system date between a range (ie 10/01/02 and 10/31/02) and if the current date falls within that range the cell value would input a number from another cell? After the date range is pasted (ie 11/01/02) the number in the cell would remain as it was on the last day.

I have Simply in cell P27 the formula =SUM(P25:P26) and it equals say 25.

IF today is 10/8/02 then cell O33 would get the number 25 input into it.

A coworkers attempts have brought this formula (that doesn't work):

=IF(TODAY()<DATE(2002,11,1),O33=P27,O33=O33)


_________________
David L. Churchill, MSgt, MNANG
Network Administrator
david.churchill@mndulu.ang.af.mil
Comm: (218) 788-7897
FAX: (218) 788-7457
"Experience... is simply the name we give to our mistakes."
||||| /
/ [_]
(-) (
This message was edited by Juan Pablo G. on 2002-10-09 17:07

I did not follow all your cell references.

with criteria in G2 and G3

=AND(TODAY()<=G3,TODAY()>=G2) will give
True if Today is within criteria

then if True put value from O33 into cell other wise blank

=IF(AND(TODAY()<=G3,TODAY()>=G2),O33,"")

or

=(MONTH(TODAY())=10)*O33

Each of the above work only for the current month.

You can copy and then paste special as value to eliminate the formula and leave the information.

HTH Dave
 
Upvote 0
Hi David,

Sorry, but what you want to do cannot be accomplished with a cell formula since it creates a circular reference. The following VBA code should accomplish the same thing without the problem:

Private Sub Worksheet_Calculate()
If Date < #11/1/2002# Then
[o33] = [p27]
End If
End Sub

This code must be inserted into the worksheet's event code module. To do this, right-click on the worksheet's tab, select View Code, and paste this code into the VBE code pane. It will check the date condition each time the worksheet calculates.
 
Upvote 0
Damon/HTH Dave,

Thank you for the suggestions. With your input we came up with this (and it works!)

=IF(AND(TODAY()>DATE(2002,11,1), TODAY()<DATE(2002,11,30)),P27,O33)

Thanks again!

Church
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,003
Members
448,935
Latest member
ijat

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