Date Input Expression Builder

Nela817

New Member
Joined
Feb 24, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello,
I am trying to create an expression that will control a users date input in reference to a pervious field.

This is what I currently have: [Field 1]<=[Field 2]<=[Field 3]<=[Field 4]<=[Field 5]

Field 1 has an expression/Validation rule of: <=Now()

Essentially, I want the first field to have a date input of today or earlier (which I have), then each field after that to have a the same rule but instead of the 'Now' I want it from the previous date that was inputted. The above long expression does not work, and I do not know how to fix this.

So example if today I finished field 1, I would put today's date, if I finished field 2 today, I would put todays date, HOWEVER field 2 can not be finished before field 1 (same goes for the rest of the fields). So all fields can be finished on the same day or later from each other. BUT not in the future, so today I am on field 2 and I anticipate finishing tomorrow, but I have to wait till tomorrow to put the date in.

Please help!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I'm not aware of a string of comparisons working that way... maybe rewrite it to this (but still I don't know this will work):

Code:
[Field 1]<=[Field 2] AND [Field 2]<=[Field 3] AND [Field 3]<=[Field 4] AND [Field 4]<=[Field 5]

Also, it generally helps to know when something doesn't work exactly isn't working and whether there are any error messages.
 
Upvote 0
Not enough info IMO. This expression is where? "Doesn't work" is not very helpful.
Validation rules are a property of a table field and you cannot compare multiple fields in a table validation rule. Expressions outside of table field validation are another matter. Your logic would work in code (e.g. form AfterUpdate) if the syntax for each field reference was proper; i.e. Me.Field1
 
Upvote 0
BTW, since the first field contains the result of Now() it will contain a time and a date. If you simply pick dates using the built in calendar control for textboxes you get time values of midnight (12:00:00 AM). Thus every other field in the form will have the same time. If any 2 of these have the same date, then they are equal. It may be that a situation will arise where the comparison being made is thought to be 02/25/2021 10:30: 25 AM <= 02/25/2021 08:30:25 AM which is false, but in fact it will be 02/25/2021 12:00:00 AM <= 02/25/2021 12:00:00 AM which is true. If this is important, one must ensure time values are stored as well as the date.
 
Upvote 0
To clarify, when I say it doesn't work, I can put any dates in, the system doesn't recognize that I put restrictions as a Validation rule.
 
Upvote 0
So I can put any date in those fields. No error messages pop up. It's like nothing was even typed as a validation rule
 
Upvote 0
To clarify, when I say it doesn't work, I can put any dates in, the system doesn't recognize that I put restrictions as a Validation rule.
Is the validation being done on a form? A table?

You're still not providing enough for anyone to assist, unfortunately.
 
Upvote 0
I'm not aware of a string of comparisons working that way... maybe rewrite it to this (but still I don't know this will work):

Code:
[Field 1]<=[Field 2] AND [Field 2]<=[Field 3] AND [Field 3]<=[Field 4] AND [Field 4]<=[Field 5]

Also, it generally helps to know when something doesn't work exactly isn't working and whether there are any error messages.
Thank you for this, unfortunately this didn't do anything. No error message pops up, and it doesn't put restrictions. I appreciate the effort.
 
Upvote 0
Is the validation being done on a form? A table?

You're still not providing enough for anyone to assist, unfortunately.
I apologize, I am trying to place this in a table. While I am in Datasheet view > Fields tab > Validation > Validation Rule.

Would it be better to do this as a form rule?
I'm still new with this, I appreciate your patience.
 
Upvote 0
BTW, since the first field contains the result of Now() it will contain a time and a date. If you simply pick dates using the built in calendar control for textboxes you get time values of midnight (12:00:00 AM). Thus every other field in the form will have the same time. If any 2 of these have the same date, then they are equal. It may be that a situation will arise where the comparison being made is thought to be 02/25/2021 10:30: 25 AM <= 02/25/2021 08:30:25 AM which is false, but in fact it will be 02/25/2021 12:00:00 AM <= 02/25/2021 12:00:00 AM which is true. If this is important, one must ensure time values are stored as well as the date.
ahh, I don't absolutely need the time. Right now just the date is important.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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