Formatting dates Coming up with odd values

psulions83

Board Regular
Joined
Nov 16, 2015
Messages
126
Hi All,

I am trying to input dates into a sheet in QTR/YEAR format. Q2 would be 02/2017 and so forth. When I do this I get 0.000991571641051066 as the value. I am going to need to upload these to a database and this value is going to have the wrong output. I used a custom format of 00/0000 and that shows me the correct display but when clicking into the cell I get the long decimal value. Is there a way around this besides inputting the cells different?

Any help is much appreciated! I uploaded an image of the results.
 

Attachments

  • Capture.JPG
    Capture.JPG
    77.4 KB · Views: 7
that works well except for the ones that simplify the fractions. ie 04/2006 to 02/1003.
You must have a very old company if you have records from the year 1003. Can you give me a realistic example of that kind of conflict that might be found in your data?
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I should probably explain myself better.

I took a unique listing of the quarters and put in =TEXT(B3,"00/0000"). This worked great for all time periods minus the ones that could be simplified. So Q4 2006 which was 04/2006 simplified to 02/1003. Excel is simplifying it before it converts.
 
Upvote 0
I should probably explain myself better.

I took a unique listing of the quarters and put in =TEXT(B3,"00/0000"). This worked great for all time periods minus the ones that could be simplified. So Q4 2006 which was 04/2006 simplified to 02/1003. Excel is simplifying it before it converts.
I get that, but what I am asking you if it matters for the practical effort of converting the data you have back into text? You could handle it with conditional fix-ups, though the formulas get pretty long* :

Book1
ABCDEFG
1Cell FormatCell Format
2QuarterYearRaw number"00/0000"Data TypeGeneralData Type
3119000.00052631601/1900<= Double01/1900<= String
4220170.00099157202/2017<= Double02/2017<= String
5320170.00148735703/2017<= Double03/2017<= String
6420170.00198314304/2017<= Double04/2017<= String
7120170.00049578601/2017<= Double01/2017<= String
8220170.00099157202/2017<= Double02/2017<= String
9320170.00148735703/2017<= Double03/2017<= String
10420020.00199800202/1001<= Double04/2002<= String
11120170.00049578601/2017<= Double01/2017<= String
12220060.00099700901/1003<= Double02/2006<= String
13420060.00199401802/1003<= Double04/2006<= String
14420080.00199203201/0502<= Double04/2008<= String
Sheet1 (3)
Cell Formulas
RangeFormula
C3:C14C3=A3/B3
D3:D14D3=C3
F3:F14F3=RIGHT("00" & ((VALUE(LEFT(TEXT($D3,"00/0000"),2)))*IF(VALUE(RIGHT(TEXT(D3,"00/0000"),4))< 1900,2,1))*(IF((VALUE(RIGHT(TEXT(D3,"00/0000"),4)))*IF(VALUE(RIGHT(TEXT(D3,"00/0000"),4))< 1900,2,1)< 1900,2,1)),2) & "/" & RIGHT("00" & ((VALUE(RIGHT(TEXT(D3,"00/0000"),4)))*IF(VALUE(RIGHT(TEXT(D3,"00/0000"),4))< 1900,2,1))*(IF((VALUE(RIGHT(TEXT(D3,"00/0000"),4)))*IF(VALUE(RIGHT(TEXT(D3,"00/0000"),4))< 1900,2,1)< 1900,2,1)),4)


Or you could shift to a VBA UDF. But the point here is that all this is repair work - a fixup to correct quarter data already entered as 02/2017 which excel sees as a fractional number 0.000991572. Unless you are constrained by the database format, and you indicated you are not - you should revisit your decision to enter quarter dates like that and instead get rid of the custom format "00/0000" and enter them so they are represented in excel as text ("02/2017") not as fractional numbers.

*(Fyi, I happen to be using an older version of excel at the moment. If you have the Office 365 version, there are newer built-in functions like "LET" which can allow you to shrink the forumla show here substantially)
 
Upvote 0
you are right. The text solution helped fix 80% of them. The ones that could be simplified I manually fixed them. Thank you for the help with this!
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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