# IF Date = This then enter this number

#### Church

##### New Member
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
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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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
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

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

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.

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

Replies
5
Views
424
Replies
5
Views
435
Replies
2
Views
630
Replies
3
Views
251
Replies
1
Views
483

1,218,651
Messages
6,143,714
Members
450,502
Latest member
sakaria_123

### 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.

### Which adblocker are you using?

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

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