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 to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,971
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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
 

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
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.
 

Church

New Member
Joined
Oct 8, 2002
Messages
2
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
 

Forum statistics

Threads
1,144,272
Messages
5,723,433
Members
422,497
Latest member
dougy99

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
Top