Displaying an Input Format in a Cell

by Allen Wyatt
(last updated February 21, 2015)

2

Greg uses Excel to calculate time which means he has a lot of formatted cells that look like this: Mar 10 15:00. People who use his worksheet constantly seem to enter time in a format other than his preferred format. For instance, they leave out the colon or the month and wonder why it won't calculate correctly. Greg has seen other Excel worksheets where the preferred format is "pre-entered" in each applicable cell for the user in a grayed-out form, such as: mmm dd hh:mm. Greg wonders how to do that with Excel.

There is no simple, easy way to do anything like this in Excel. The closest thing we've seen is the input mask feature available in Access, but not in Excel. It is possible that what Greg saw in other Excel worksheets was due to some add-in on that system or some set of complex macros that handled the display.

It is best to remember that the formatting of a cell is for display only, it does not affect the value of the cell itself. If the user does not enter a valid date and time or it is an incomplete date and time the value stored in the cell will be incorrect. Pre-entering the preferred date format into the cell will not prevent them from using other formats.

You could, if desired go the simple route and simply add comments to the input cells. The comments could explain the input format and even the importance of using the correct format. People would, of course, be able to ignore the comments completely.

If this is a problem, one thing you could attempt is to "pre-enter" text displaying the desired format ("mmm dd hh:mm") and use conditional formatting to make the text gray when the cell has that particular text or make the explicit formatting gray and then conditional format it black when the cell is anything other than the example text. But that will not prevent the user from entering a date and time using a different format or misentering the values (by not including a needed piece of information).

Simple Excel pulldowns can be used to allow the user to select month, day, year, hour, and minute in separate cells and then use a formula to pull it together. You could even use more complicated means of data validation to ensure data is being entered in an acceptable manner, but a date and time are still numbers so checking the validity becomes difficult. Allowing easier entry is possible and some possible tips in doing things can be found at these pages:

http://excelribbon.tips.net/T012550_Using_an_Input_Mask.html
http://www.contextures.com/xlDataVal12.html
http://www.cpearson.com/excel/datetimeentry.htm

There are various "date picker" and "time picker" add-ins that people have created in Excel (some customizeable, others not) that can be googled and tested or a custom one created in VBA.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (1113) applies to Microsoft Excel 2007, 2010, and 2013.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Understanding Mirror Margins

Rather than have the margins of your documents always be the same, you can use what Word calls "mirror margins." Here's how ...

Discover More

Controlling How Excel Interprets Percentages

When entering data in a worksheet, Excel tries to figure out how your entry can best be shown on the screen. When it comes to ...

Discover More

Counting Displayed Cells

When you filter data, Excel displays only a portion of what is really in a worksheet. If you want to count the number of ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Splitting Information into Rows

Got too much information in a single cell? Here's how you can use a macro to pull apart that information and put it into ...

Discover More

Merging Cells to a Single Sum

One way to make your worksheets less complex is to get rid of detail and keep only the summary of that detail. Here's how you ...

Discover More

Three-Dimensional Transpositions

Excel makes it easy to transpose your data so that rows become columns and columns rows. It doesn't have a built-in ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 + 8?

2015-02-22 05:11:33

Hans

If Greg doesn't mind using VBA you could create a simple UDF that checks the the eneterd value and if dos not conform to the requirement,clear the entered value again, of course this will require either an Add-in or a macrom embedded file


2015-02-21 08:56:54

Colin

"You could even use more complicated means of data validation to ensure data is being entered in an acceptable manner, but a date and time are still numbers so checking the validity becomes difficult."
Excel's Data Validation (which is not really complicated at all) allows the user to specify that the data entered must be a date or time (with various conditions, such as greater than, between, etc.), as well as offering the opportunity to instruct the user when the cell is clicked as to how the data should be entered. Judicious use of this functionality should provide Greg with the solution he is seeking.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.