Forum Discussion

P00993957's avatar
P00993957
Copper Contributor
Jul 10, 2024

Date Automatically Convert Into Decimal number, How To Stop It

While I am downloading the file from SAP or mail where already some date mentioned, but at the time of opening that file date automatically converted into decimal figure, is there any option to stop it. 

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    P00993957 

    When dates are imported into Excel from systems like SAP or email attachments, they sometimes appear as decimal numbers. This happens because Excel stores dates as serial numbers, with January 1, 1900, as day 1. If the format isn't correctly set, these numbers can appear as decimals.

    To ensure that dates are correctly recognized and formatted in Excel, you can follow these steps:

    Step-by-Step Solution:

    1. Change the Column Format to Date:

    If dates are imported as decimal numbers, you can manually change the format of the column to a date format:

    1. Select the Column: Click on the header of the column containing the dates.
    2. Open Format Cells Dialog:
      • Right-click on the selected column and choose Format Cells.
      • Alternatively, you can press Ctrl + 1 to open the Format Cells dialog.
    3. Choose Date Format:
      • In the Format Cells dialog, go to the Number tab.
      • Select Date from the list on the left.
      • Choose the desired date format from the right.
      • Click OK.

    2. Convert Imported Dates with Text-to-Columns:

    If dates are still not appearing correctly, you can use the Text-to-Columns feature:

    1. Select the Column: Click on the header of the column containing the dates.
    2. Open Text-to-Columns Wizard:
      • Go to the Data tab on the ribbon.
      • Click on Text to Columns.
    3. Choose Delimited:
      • In the wizard, choose Delimited and click Next.
    4. Select Delimiters:
      • Uncheck all delimiter options and click Next.
    5. Choose Column Data Format:
      • Select Date and choose the appropriate date format (e.g., MDY, DMY) based on your data.
      • Click Finish.

    3. Check Regional Settings:

    Ensure that your regional settings match the date format used in the SAP or email file:

    1. Open Control Panel:
      • Press Windows + R, type control, and press Enter.
    2. Go to Region:
      • Click on Clock and Region (or Region and Language).
      • Click on Region.
    3. Format Settings:
      • Ensure that the Short date format matches the format in your imported file.
      • Click OK to apply changes.

    4. Use Power Query for Importing Data:

    For more advanced and automated handling of dates, consider using Power Query:

    1. Load Data with Power Query:
      • Go to the Data tab on the ribbon.
      • Click Get Data (or Get & Transform Data).
      • Choose the appropriate data source (e.g., From Text/CSV, From Web).
    2. Transform Data:
      • In the Power Query Editor, ensure the column with dates is set to the Date data type.
      • Click Close & Load to load the transformed data back into Excel.

    5. Use Excel Formulas to Convert Decimals to Dates:

    If you have a column of decimal numbers that represent dates, you can use formulas to convert them:

    1. Use the TEXT Function:
      • Suppose the decimal numbers are in column A, starting from A2. In B2, enter:

    =TEXT(A2, "dd/mm/yyyy")

      • Drag the formula down to convert all decimal numbers to dates.
    1. Use the DATEVALUE Function:
      • If your dates are in text format, you can use DATEVALUE to convert them to date serial numbers:

    =DATEVALUE(A2)

      • Format the resulting column as dates using the Format Cells dialog.

    By following these steps, you should be able to ensure that dates imported from SAP or email attachments are correctly recognized and displayed as dates in Excel. The text and steps were edited with the help of AI.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    Was the answer useful? Mark as best response and Like it!

    This will help all forum participants.

Resources