MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 24th, 2002, 05:21 PM   #1
reh37
New Member
 
Join Date: Apr 2002
Location: BobH
Posts: 7
Default

I want to enter a numeric date (61592) and have Excel convert it to (06/15/92). I've selected the cells and used the Format/Cells and Date selection, however, when I enter the numeric date, Excel converts it to some new date and present it with in the mm/dd/yy format. How can I turn off this conversion, or enter the numeric data so I can do the formatting?

reh37 is offline   Reply With Quote
Old Apr 24th, 2002, 05:23 PM   #2
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

See http://www.mrexcel.com/board/viewtop...c=6233&forum=2.

Keep in mind that Excel has it's own internal date values that are recognized and properly displayed by Excel's built-in date formats. See the Excel Help Index topic for "How Microsoft Excel performs date and time calculations"

[ This Message was edited by: Mark W. on 2002-04-24 16:27 ]
Mark W. is offline   Reply With Quote
Old Apr 25th, 2002, 05:35 PM   #3
reh37
New Member
 
Join Date: Apr 2002
Location: BobH
Posts: 7
Default

A friend provided a solution to this problem. The solution is: Select column for all cells, or select cell.
Select FORMAT, CELLS, NUMBER, CUSTOM.
In the "type" area key in the following mask:
0#"/"##"/"##
Hit enter to enter this mask.
The cells in the column have now been formatted and the user can enter numeric data that will be automatically formatted with the slashes (mm/dd/yy). No conversion will take place.
reh37 is offline   Reply With Quote
Old Apr 25th, 2002, 05:42 PM   #4
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Quote:
On 2002-04-25 16:35, reh37 wrote:
A friend provided a solution to this problem. The solution is: Select column for all cells, or select cell.
Select FORMAT, CELLS, NUMBER, CUSTOM.
In the "type" area key in the following mask:
0#"/"##"/"##
Hit enter to enter this mask.
The cells in the column have now been formatted and the user can enter numeric data that will be automatically formatted with the slashes (mm/dd/yy). No conversion will take place.
Yes, but these won't be translated by Excel into internal date values. You won't be able to use them in formulas as though they were dates [e.g., =MONTH(A1)]. I trust your friend explained that to you.
Mark W. is offline   Reply With Quote
Old Apr 26th, 2002, 12:30 PM   #5
TiggerToo
Board Regular
 
Join Date: Feb 2002
Location: Macon, Georgia USA
Posts: 124
Default

try this:

=(left(a1,1+(len(a1)>5))&"/"&mid(a1,2+(len(a1)>5),2)&"/"&right(a1,2))+0

or

=date(1900+right(a1,2),left(a1,1+(len(a1)>5)),mid(a1,2+(len(a1)>5),2))

I got this from someplace I cannot remember right now, but i hope this help.

Walter

Never stop learning
TiggerToo is offline   Reply With Quote
Old Apr 26th, 2002, 01:32 PM   #6
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Quote:
On 2002-04-26 11:30, TiggerToo wrote:
try this:

=(left(a1,1+(len(a1)>5))&"/"&mid(a1,2+(len(a1)>5),2)&"/"&right(a1,2))+0

or

=date(1900+right(a1,2),left(a1,1+(len(a1)>5)),mid(a1,2+(len(a1)>5),2))

I got this from someplace I cannot remember right now, but i hope this help.

Walter

Never stop learning
An awful lot of typing when...

=TEXT(A1,"0-00-0000")+0

...will suffice!

[ This Message was edited by: Mark W. on 2002-04-26 12:33 ]
Mark W. is offline   Reply With Quote
Old May 12th, 2002, 11:37 AM   #7
reh37
New Member
 
Join Date: Apr 2002
Location: BobH
Posts: 7
Default

I tried to use your simplified formatting formula, but could not get it to work. Excel returned errors. Thanks for trying to help.
reh37 is offline   Reply With Quote
Old May 12th, 2002, 12:23 PM   #8
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-04-25 16:35, reh37 wrote:
A friend provided a solution to this problem. The solution is: Select column for all cells, or select cell.
Select FORMAT, CELLS, NUMBER, CUSTOM.
In the "type" area key in the following mask:
0#"/"##"/"##
Hit enter to enter this mask.
The cells in the column have now been formatted and the user can enter numeric data that will be automatically formatted with the slashes (mm/dd/yy). No conversion will take place.
Like Mark said, just because you can make it look like a date, it does not mean it will be a Date to Excel for calculations, sorting etc. Mark has provided a very elegant solution for converting the text string to Date.
To make a string of text into dates, you can also use the date function which takes the year, month, and day as arguments.
So say I have a text string '06152002 in cell A1, where 06 represents month, 15 represents the day, and 2002 represents the year, then

=DATE(right(A1,4),left(a1,2),mid(A1,3,2))

will truly convert that text string into DATE for Excel.

_________________
Yogi Anand
Edit: Deleted inactive web site reference from hard code signature line

[ This Message was edited by: Yogi Anand on 2003-01-19 17:16 ]
Yogi Anand is offline   Reply With Quote
Old May 12th, 2002, 01:11 PM   #9
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Quote:
On 2002-05-12 10:37, reh37 wrote:
I tried to use your simplified formatting formula, but could not get it to work. Excel returned errors. Thanks for trying to help.
If you're trying to convert a date represented as a 5 or 6-digit integer, modify my suggested formula as shown below...

=TEXT(A1,"0-00-00")+0


[ This Message was edited by: Mark W. on 2002-05-12 12:12 ]
Mark W. is offline   Reply With Quote
Old May 12th, 2002, 01:32 PM   #10
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-05-12 12:11, Mark W. wrote:
Quote:
On 2002-05-12 10:37, reh37 wrote:
I tried to use your simplified formatting formula, but could not get it to work. Excel returned errors. Thanks for trying to help.
If you're trying to convert a date represented as a 5 or 6-digit integer, modify my suggested formula as shown below...

=TEXT(A1,"0-00-00")+0


[ This Message was edited by: Mark W. on 2002-05-12 12:12 ]
Hi Mark:
With the two digit year representation, caution regarding the cutoff year of 29 still applies (year numbers 29 or less will be in the 2000 series, and 30 or above will be considered in the 1900 series).

It is interesting that conversion of text strings using your formula works with the '-' character but not with the '/' character, although generally Excel will accept date with either of the two characters. Any toughts on that!

Regards
Yogi Anand is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:22 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes