You are dating my excel

Excel for Microsoft 365 Excel for the web Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010 More…Less

Microsoft Excel is preprogrammed to make it easier to enter dates. For example, 12/2 changes to 2-Dec. This is very frustrating when you enter something that you don’t want changed to a date. Unfortunately there is no way to turn this off. But there are ways to get around it.

Preformat the cells you want to enter numbers into as Text. This way Excel will not try to change what you enter into dates.

If you only have a few numbers to enter, you can stop Excel from changing them into dates by entering:

  • A space before you enter a number. The space remains in the cell after you press Enter. (See Notes)

  • An apostrophe (‘) before you enter a number, such as ’11-53 or ‘1/47. The apostrophe isn’t displayed in the cell after you press Enter.

  • A zero and a space before you enter a fraction such as 1/2 or 3/4 so that they don’t change to 2-Jan or 4-Mar, for example. Type 0 1/2 or 0 3/4. The zero doesn’t remain in the cell after you press Enter, and the cell becomes the Fraction number type.

  1. Select the cells that you’ll enter numbers into.

  2. Press Ctrl + 1 (the 1 in the row of numbers above the QWERTY keys) to open Format Cells.

  3. Select Text, and then click OK.

  1. Select the cells you want to enter numbers into.

  2. Click Home > Number Format > Text.

Notes: 

  • We recommend using an apostrophe instead of a space for entering data if you plan on using lookup functions against the data. Functions like MATCH or VLOOKUP overlook the apostrophe when calculating the results.

  • If a number is left-aligned in a cell that usually means it isn’t formatted as a number.

  • If you type a number with an “e” in it, such as 1e9, it will automatically result in a scientific number: 1.00E+09. If you don’t want a scientific number, enter an apostrophe before the number: ‘1e9

  • Depending on the number entered, you may see a small green triangle in the upper left corner of the cell, indicating that a number is stored as text, which to Excel is an error. Either ignore the triangle, or click on it. A box will appear to the left. Click the box, and then select Ignore Error, which will make the triangle go away.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Need more help?

Sometimes importing data into spreadsheets can be a headache. While this issue is not directly related to Datawrapper, it’s a common problem with Excel that can be frustrating and time-consuming: Excel is trained to «detect» formats, and sometimes the software wrongly assumes that a certain number represents a date. If you enter 12/2, it will change to 2-Dec or 12. Feb. If you then ask Excel to change the format to «Text,» it shows you a weird high number like 44239. 

So, how can you show a column with values like 12/2 without having them converted into dates?

How to get around this in Excel

The trick is to choose the format of the column before you enter or paste the data:

  • Open Excel 
  • Select the columns or cells you want to paste into and choose «Text» in the format dropdown of the Home tab. You can also press Cmd+1 to select «Text» there and then click «Ok.» 
  • Now make sure that your data is pasted as text. To do so, go to the Home tab, then click on the little arrow next to «Paste» and select «Match Destination Formatting.» (To achieve the same result, you can also go to Edit > Paste Special…, and then select «Text» before clicking «Ok.»)
  • You’ll see little green triangles in the top left of your pasted cells. Select them, click on the warning sign ⚠️ and select «Ignore Error.»

Here’s a 30 second video showing the whole process: 

Please note that you can’t perform calculations such as SUM with the pasted text. 

Choosing the correct format in Datawrapper

Even if Excel now thinks that your numbers are text, our data visualization tool Datawrapper will be able to recognize them. As soon as you upload the numbers to Datawrapper, it guesses what data format your columns have. 

If that guess is wrong, you can easily change the format again. Click on the column, then choose the correct format in the drop-down menu that pops up on the left side:

Special formatting tricks to avoid having Excel change numbers into dates

Excel documentation has some additional tips on how to avoid that automatic change of numbers:

  • Manual inspection
    If your dataset has only a few lines, you can manually check whether datapoints where wrongly changed into dates. They are quite easy to spot in the columns.
  • To then change the format back: 
    • Add a space before the number. Press Enter to make sure that this space remains in the cell.
    • Or, add an apostrophe (‘) BEFORE you enter the number, e.g. ‘1/2. The apostrophe will not be displayed after pressing Enter.
    • Or, add a zero and space before number formats such as 1/2 to avoid the change to date format.
    • Or, change fractions into decimals, e.g. 1/2 to 0.5 (or 0,5, if that is your local decimal format).

Last updated on July 13, 2022

Dating spreadsheet.

TikTok user Emily shared a spread sheet of how she keep track of all the men she’s dating.
Tiktok/@crumbletumble00

She’s getting down to business.

A woman has gone viral with her highly organized dating strategy — creating an Excel spreadsheet to keep track of her love interests with detailed notes and photos of them.

A TikTok user named Emily, who goes by @crumbletumble00, shared her Dating Tracker, as she calls it. It’s a detailed document, starting with a slate of checkable boxes listing classifications from “New to the mix,” “It’s over,” all the way to “WE MADE IT!”

The spreadsheet also includes notes and stats for each guy, including name, “insider nickname,” phone number, a photo, age and profession. 

TikTok user Emily organizes her love life with an Excel spreadsheet.

Single TikTok user Emily made a video detailing a massive Excel spreadsheet she uses to keep track of her dating life.
Tiktok/@crumbletumble00
dating-excel
The Dating Tracker, as Emily calls it, is a detailed document, starting with classifications from “New to the mix,” “It’s over,” all the way to “WE MADE IT!”
Tiktok/@crumbletumble00

In a post, the TikTok user asks herself “How do you keep track of all the men you are talking to Emily?” and then shows viewers a massive spreadsheet on her computer.

The relationship-seeking single mines for info on her potential suitors and potential red flags, like, say, if their religion does not align with her own beliefs. She also lists whether or not a guy has a car, if he likes dogs – brownie points if he wants one – and if he has allergies, playfully noting: “don’t want to kill the guy.” 

Emily's spread sheet details a suitor's name, nickname, profession, age and lists details about their first date.

Emily’s spreadsheet details a suitor’s name, nickname, profession, age and lists details about their first date, among other things.
Tiktok/@crumbletumble00

A red tab is used to keep track of her “No’s” — all of the fellows she’s totally rejected — while an orange tab keeps track of those that are “Just Friends.”

If she and a potential match have a great conversation, she’ll decide to meet up in real life. Then, after the date, she’ll document how it went with detailed notes on where the date took place and what she liked or didn’t like. 

The video is striking a chord, raking in more than 2 million views. 

“My 61-year-old best friend did this 30+ years ago and was dating 10 men at one point,” one user commented. “Such a queen.”

The problem: Excel does not want to recognize dates as dates, even though through «Format cells — Number — Custom» you are explicitly trying to tell it these are dates by «mm/dd/yyyy«. As you know; when excel has recognized something as a date, it further stores this as a number — such as «41004» but displays as date according to format you specify. To add to confusion excel may convert only part of your dates such as 08/04/2009, but leave other e.g. 07/28/2009 unconverted.

Solution: steps 1 and then 2

1) Select the date column. Under Data choose button Text to Columns. On first screen leave radio button on «delimited» and click Next. Unclick any of the delimiter boxes (any boxes blank; no checkmarks) and click Next. Under column data format choose Date and select MDY in the adjacent combo box and click Finish. Now you got date values (i.e. Excel has recognised your values as Date data type), but the formatting is likely still the locale date, not the mm/dd/yyyy you want.

2) To get the desired US date format displayed properly you first need to select the column (if unselected) then under Cell FormatNumber choose Date AND select Locale : English (US). This will give you format like «m/d/yy«. Then you can select Custom and there you can either type «mm/dd/yyyy» or choose this from the list of custom strings.

Alternative 0 : use LibreOffice Calc. Upon pasting data from Patrick’s post choose Paste Special (Ctrl+Shift+V) and choose Unformatted Text. This will open «Import Text» dialog box. Character set remains Unicode but for language choose English(USA); you should also check the box «Detect special numbers». Your dates immediately appear in the default US format and are date-sortable. If you wish the special US format MM/DD/YYYY you need to specify this once through «format Cells» — either before or after pasting.

One might say — Excel should have recognised dates as soon as I told it via «Cell Format» and I couldn’t agree more. Unfortunately it is only through step 1 from above that I have been able to make Excel recognize these text strings as dates. Obviously if you do this a lot it is pain in the neck and you might put together a visual basic routine that would do this for you at a push of a button. It can be as simple as this VBA code in Excel:

Sub RemoveApostrophe()

For Each CurrentCell In Selection
If CurrentCell.HasFormula = False Then    
CurrentCell.Formula = CurrentCell.Value
End If
Next

End Sub

Alternative 1: Data | Text to Columns

Update on leading apostrophe after pasting: You can see in the formula bar that in the cell where date was not recognised there is a leading apostrophe. That means in the cell formatted as a number (or a date) there is a text string that program thinks — you want to preserve as a text string. You could say — the leading apostrophe prevents the spreadsheet to recognise the number. You need to know to look in formula bar for this — because the spreadsheet simply displays what looks like a left-aligned number. To deal with this, select the column you want to correct, choose in menu Data | Text to Columns and click OK. Sometimes you will be able to specify the data type, but if you have previously set the format of the column to be your particular data type — you will not need it. The command is really meant to split a text column in two or more using a delimiter, but it works like a charm for this problem too. I have tested it in Libreoffice, but there is the same menu item in Excel too.

Alternative 2: Edit Replace in Libreoffice

This is the quickest and best way so far, but that does not work in MsOffice as far as I know. Libreoffice Calc has option to search/replace using Regexps (aka. Regular Expressions) — what you do is find the cell and replace with itself and in the process Calc re-recognises the number as number and gets rid of the leading apostrophe. It works extremely quick. Select your column. Ctrl-H opens find-replace dialogue. Check ‘Current selection’ and ‘Use regular expressions’. In the find box enter ^[0-9] — which means ‘find any cell that has a digit 0 to 9 in its first position’. In the replace box enter & — which for libreoffice means ‘for replacement use string you found in the search box’. Click Replace All — and your values are recognised for numbers that they are. The beauty is — it works on cells that contain only numbers with a leading apostrophe, nothing else — i.e. it will not touch cells that contain apostrophe-a space (or two)-then number, or cells that contain capital O instead of zero or any other anomalies you want to correct by hand.

answered Sep 26, 2014 at 12:49

r0berts's user avatar

r0bertsr0berts

1,8961 gold badge16 silver badges19 bronze badges

6

Select all the column and go to Locate and Replace and just replace "/" with /.

kenorb's user avatar

kenorb

24k26 gold badges124 silver badges190 bronze badges

answered Aug 28, 2015 at 17:14

Jair Bressani's user avatar

5

I was dealing with a similar issue with thousands of rows extracted out of a SAP database and, inexplicably, two different date formats in the same date column (most being our standard «YYYY-MM-DD» but about 10% being «MM-DD-YYY»). Manually editing 650 rows once every month was not an option.

None (zero… 0… nil) of the options above worked. Yes, I tried them all. Copying to a text file or explicitly exporting to txt still, somehow, had no effect on the format (or lack therefo) of the 10% dates that simply sat in their corner refusing to behave.

The only way I was able to fix it was to insert a blank column to the right of the misbehaving date column and using the following, rather simplistic formula:

(assuming your misbehaving data is in Column D)

=IF(MID(D2,3,1)="-",DATEVALUE(TEXT(CONCATENATE(RIGHT(D2,4),"-",LEFT(D2,5)),"YYYY-MM-DD")),DATEVALUE(TEXT(D2,"YYYY-MM-DD")))

I could then copy the results in my new, calculated column over top of the misbehaving dates by pasting «Values» only after which I could delete my calculated column.

bertieb's user avatar

bertieb

7,26436 gold badges40 silver badges52 bronze badges

answered Apr 10, 2017 at 21:49

Lucster's user avatar

LucsterLucster

411 silver badge1 bronze badge

I had the exact same issue with dates in excel. The format matched the requirements for a date in excel, yet without editing each cell it would not recognise the date, and when you are dealing with thousands of rows it is not practical to manually edit each cell. Solution is to run a find and replace on the row of dates where i replaced the hypen with a hyphen. Excel runs through the column replacing like with like but the resulting factor is that it now recongnises the dates! FIXED!

answered Feb 22, 2016 at 9:06

Warren Rocchi's user avatar

This may not be relevant to the original questioner, but it may help someone else who is unable to sort a column of dates.

I found that Excel would not recognise a column of dates which were all before 1900, insisting that they were a column of text (since 1/1/1900 has numeric equivalent 1, and negative numbers are apparently not allowed). So I did a general replace of all my dates (which were in the 1800s) to put them into the 1900s, e.g. 180 -> 190, 181 -> 191, etc. The sorting process then worked fine. Finally I did a replace the other way, e.g. 190 -> 180.

Hope this helps some other historian out there.

answered Jun 25, 2017 at 9:14

Laurie Allen's user avatar

It seems that Excel does not recognize your dates as dates, it recognizes them text, hence you get the Sort options as A to Z. If you do it correctly, you should get something like this:

http://i.stack.imgur.com/Qb4Pj.png

Hence, it is important to ensure that Excel recognizes the date. The most simple way to do that, is use the shortcut CTRL+SHIFT+3.

Here’s what I did to your data. I simply copied it from your post above and pasted it in excel. Then I applied the shortcut above, and I got the required sort option. Check the image.

http://i.stack.imgur.com/yAa6a.png

CharlieRB's user avatar

CharlieRB

22.5k5 gold badges55 silver badges104 bronze badges

answered Sep 26, 2014 at 11:41

Chainsaw's user avatar

ChainsawChainsaw

1382 gold badges2 silver badges8 bronze badges

6

I would suspect the issue is Excel not being able to understand the format… Although you select the Date format, it remains as Text.

You can test this easily: When you try to update the dates format, select the column and right click on it and choose format cells (as you already do) but choose the option 2001-03-14 (near bottom of the list). Then review the format of your cells.

I will suspect that only some of the date formats update correctly, indicating that Excel still treating it like a string, not a date (note the different formats in the below screen shot)!

enter image description here

There are work-arounds for this, but, none of them will be automated simply because you’re exporting each time. I would suggest using VBa, where you can simply run a macro which converts from US to UK date format, but, this would mean copying and pasting the VBa into your sheet each time.

Alternatively, you create an Excel that reads the newly created exported Excel sheets (from exchange) and then execute the VBa to update the date format for you. I will assume the Exported Exchange Excel file will always have the same file name/directory and provide a working example:

So, create new Excel sheet, called ImportedData.xlsm (excel enabled). This is the file where we will import the Exported Exchange Excel file into!

Add this VBa to the ImportedData.xlsm file

Sub DoTheCopyBit()

Dim dateCol As String
dateCol = "A"        'UPDATE ME TO THE COLUMN OF THE DATE COLUMN

Dim directory As String, fileName As String, sheet As Worksheet, total As Integer

Application.ScreenUpdating = False
Application.DisplayAlerts = False

directory = "C:UsersDaveDesktop"                   'UPDATE ME
fileName = Dir(directory & "ExportedExcel.xlsx")       'UPDATE ME (this is the Exchange exported file location)

Do While fileName <> ""

'MAKE SURE THE EXPORTED FILE IS OPEN
Workbooks.Open (directory & fileName)

Workbooks(fileName).Worksheets("Sheet1").Copy _

Workbooks(fileName).Close

fileName = Dir()

Loop

Application.ScreenUpdating = True
Application.DisplayAlerts = True

Dim row As Integer
row = 1
Dim i As Integer
Do While (Range(dateCol & row).Value <> "")

     Dim splitty() As String
     splitty = Split(Range(dateCol & row).Value, "/")
     Range(dateCol & row).NumberFormat = "@"
     Range(dateCol & row).Value = splitty(2) + "/" + splitty(0) + "/" + splitty(1)
     Range(dateCol & row).NumberFormat = "yyyy-mm-dd"
     row = row + 1
Loop


End Sub

What I also did was update the date format to yyyy-mm-dd because this way, even if Excel gives you the sort filter A-Z instead of newest values, it still works!

I’m sure the above code has bugs in but I obviously have no idea what type of data you have but I tested it with the a single column of dates (as you have) and it works fine for me!

How do I add VBA in MS Office?

Community's user avatar

answered Mar 17, 2015 at 9:14

Dave's user avatar

DaveDave

25.2k10 gold badges55 silver badges69 bronze badges

1

I figured it out!

There is a space at the beginning and at the end of the date.

  1. If you use find and replace and press the spacebar, it WILL NOT
    work.
  2. You have to click right before the month number, press shift
    and the left arrow to select and copy. Sometimes you need to use the
    mouse to select the space.
  3. Then paste this as the space in find and
    replace and all your dates will become dates.
  4. If there is space and date Select Data>Go to Data>Text to
    columns>Delimited>Space as separator and then finish.
  5. All spaces will be removed.

djsmiley2kStaysInside's user avatar

answered May 14, 2015 at 16:46

JailDoctor's user avatar

1

If Excel stubbornly refuses to recognize your column as date, replace it by another :

  • Add a new column to the right of the old column
  • Right-click the new column and select Format
  • Set the format to date
  • Highlight the entire old column and copy it
  • Highlight the top cell of the new column and select Paste Special, and only paste values
  • You can now remove the old column.

2

I just simply copied the number 1 (one) and multiplied it to the date column (data) using the PASTE SPECIAL function. It then changes to General formating i.e 42102
Then go apply Date on the formating and it now recognises it as a date.

Hope this helps

answered Nov 17, 2015 at 8:03

Mpho Sehlako's user avatar

All the above solutions — including r0berts — were unsuccessful, but found this bizarre solution which turned out to be the fastest fix.

I was trying to sort «dates» on a downloaded spreadsheet of account transactions.

This had been downloaded via CHROME browser. No amount of manipulation of the «dates» would get them recognised as old-to-new sortable.

But, then I downloaded via INTERNET EXPLORER browser — amazing — I could sort instantly without touching a column.

I cannot explain why different browsers affect the formatting of data, except that it clearly did and was a very fast fix.

answered Apr 24, 2016 at 1:24

Ros's user avatar

My solution in the UK — I had my dates with dots in them like this:

03.01.17

I solved this with the following:

  1. Highlight the whole column.
  2. Go to find and select/ replace.
  3. I replaced all the full stops with middle dash eg 03.01.17 03-01-17.
  4. Keep the column highlighted.
  5. Format cells, number tab select date.
  6. Use the Type 14-03-12 (essential for mine to have the middle dash)
  7. Locale English (United Kingdom)

When sorting the column all dates for the year are sorted.

Gaff's user avatar

Gaff

18.4k15 gold badges57 silver badges68 bronze badges

answered Dec 13, 2016 at 11:25

Charlie's user avatar

I tried the various suggestions, but found the easiest solution for me was as follows…

See Images 1 and 2 for the example… (note — some fields were hidden intentionally as they do not contribute to the example). I hope this helps…

  1. Field C — a mixed format that drove me absolutely crazy. This is how the data came directly from the database and had no extra spaces or crazy characters. When displaying it as a text for example, the 01/01/2016 displayed as a ‘42504’ type value, intermixed with the 04/15/2006 which showed as is.

  2. Field F — where I obtained the length of field C (the LEN formula would be a length of 5 of 10 depending on the date format). The field is General format for simplicity.

  3. Field G — obtaining the month component of the mixed date — based on the length result in field F (5 or 10), I either obtain the month from the date value in field C, or obtain the month characters in the string.

  4. Field H — obtaining the day component of the mixed date — based on the length result in field F (5 or 10), I either obtain the day from the date value in field C, or obtain the day characters in the string.

I can do this for the year as well, then create a date from the three components that is consistent. Otherwise, I can use the individual day, month, and year values in my analysis.

Image 1: basic spreadsheet showing values and field names

Image 2: spreadsheet showing formulas matching explanation above

I hope this helps.

answered Jan 13, 2017 at 13:02

Eran's user avatar

5

SHARING A LITTLE LONG BUT MUCH EASIER SOLUTION TO SUBJECT…..
No need to run macros or geeky stuff….simple ms excel formulae and editing.

mixed dates excel snapshot:

enter image description here

  • The date is in the mixed format.
  • Therefore, to make a symmetrical
    date format, extra columns have been created converting that ‘mixed
    format’ date column to TEXT.
  • From that text we have identified the
    positions of «/» and middle text has been extracted determining
    date, month, year using MID formula.
  • Those which were originally dates, formula ended with ERROR / #VALUE result. — Finally, from the string we created — we have converted those to dates by DATE formula.
  • #VALUE were picked as it is by IFERROR added to DATE formula & the column was formatted as required (here, dd/mmm/yy)

* REFER THE SNAPSHOT OF EXCEL SHEET ABOVE (= mixed dates excel snapshot) *

Pierre.Vriens's user avatar

answered Aug 28, 2016 at 14:45

Patsaeed's user avatar

2

This happens all the time when exchanging date data between locales in Excel.
If you have control over the VBA program that exports the data, I suggest exporting the number representing the date instead of the date itself. The number uniquely correlates with a single date, regardless of formatting and locale.
For example, instead of the CSV file showing 24/09/2010 it will show 40445.

In the export loop when you hold each cell, if it’s a date, convert to number using CLng(myDateValue). This is an example of my loop running through all rows of a table and exporting to CSV (note I also replace commas in strings with a tag that I strip when importing, but you may not need this):

arr = Worksheets(strSheetName).Range(strTableName & "[#Data]").Value

    For i = LBound(arr, 1) To UBound(arr, 1)
        strLine = ""
        For j = LBound(arr, 2) To UBound(arr, 2) - 1
            varCurrentValue = arr(i, j)
            If VarType(varCurrentValue) = vbString Then
                varCurrentValue = Replace(varCurrentValue, ",", "<comma>")
            End If
            If VarType(varCurrentValue) = vbDate Then
                varCurrentValue = CLng(varCurrentValue)
            End If
            strLine = strLine & varCurrentValue & ","
        Next j
        'Last column - not adding comma
        varCurrentValue = arr(i, j)
            If VarType(varCurrentValue) = vbString Then
                varCurrentValue = Replace(varCurrentValue, ",", "<comma>")
            End If
            If VarType(varCurrentValue) = vbDate Then
                varCurrentValue = CLng(varCurrentValue)
            End If
        strLine = strLine & varCurrentValue

        strLine = Replace(strLine, vbCrLf, "<vbCrLf>") 'replace all vbCrLf with tag - to avoid new line in output file
        strLine = Replace(strLine, vbLf, "<vbLf>") 'replace all vbLf with tag - to avoid new line in output file
        Print #intFileHandle, strLine
    Next i

answered Sep 27, 2017 at 10:50

Mor Sagmon's user avatar

I was not having any luck with all the above suggestions — came up with a very simple solution that works like a charm. Paste the data into Google Sheets, highlight the date column, click on format, then number, and number once again to change it to number format. I then copy and paste the data into the Excel spreadsheet, click on the dates, then format cells to date. Very quick. Hope this helps.

answered Nov 9, 2017 at 14:24

Mike's user avatar

This problem was driving me crazy, then I stumbled on an easy fix. At least it worked for my data. It is easy to do and to remember. But I do not know why this works but changing types as indicated above does not.
1. Select the column(s) with the dates
2. Search for a year in your dates, for example 2015. Select Replace All with the same year, 2015.
3. Repeat for each year.
This changes the types to actual dates, year by year.
This is still cumbersome if you have many years in your data. Faster is to search for and replace 201 with 201 (to replace 2010 through 2019); replace 200 with 200 (to replace 2000 through 2009); and so forth.

answered Nov 20, 2017 at 15:59

Wally's user avatar

Select dates and run this code over it..

On Error Resume Next
    For Each xcell In Selection            
        xcell.Value = CDate(xcell.Value)     
    Next xcell                              
End Sub

Mokubai's user avatar

Mokubai

87.3k25 gold badges201 silver badges226 bronze badges

answered Jul 6, 2017 at 23:51

Kathryn's user avatar

1

No answers here have suggested Excel Power Query. I had a DateTime value (e.g. 2021-02-25T00:35:54.497Z) that excel couldn’t interpret correctly. I needed both date and time. In a new Excel workbook, I used the «Get Data > From CSV» option to load into Power Query. Then loaded the results to excel sheet and the date values are recognized correctly. Note that type datetime vs type datetimezone makes a difference. I had to datetimezone to get the correct result.

Power Query — automated script from «Excel > Get Data» GUI

let
    Source = Csv.Document(File.Contents("C:myFolderDataSet_RefreshHistory.csv"),[Delimiter=",", Columns=7, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"refreshType", type text}, {"startTime", type datetimezone}, {"endTime", type datetimezone}, {"status", type text}, {"ReportName", type text}, {"WorkspaceId", type text}, {"serviceExceptionJson", type text}})
in
    #"Changed Type"

GET DATA

enter image description here

BEFORE and AFTER

enter image description here

answered Mar 3, 2021 at 2:42

SherlockSpreadsheets's user avatar

I use a mac.

Go to excel preferences> Edit> Date options> Automatically convert date system

Also,

Go to Tables & Filters> Group dates when filtering.

The problem probably started when you received a file with a different date system, and that screwed up your excel date function

answered Nov 30, 2017 at 10:36

Stephenie's user avatar

0

I usually just create an extra column for sorting or totaling purposes so use year(a1)&if len(month(a1))=1,),"")&month(a1)&day(a1).

That will provide a yyyymmdd result that can be sorted. Using the len(a1) just allows an extra zero to be added for months 1-9.

CharlieRB's user avatar

CharlieRB

22.5k5 gold badges55 silver badges104 bronze badges

answered Sep 26, 2014 at 11:15

Paul's user avatar

1

If you import data to Excel from another program chances are the dates will come in formatted as text, which means they’re not much use to you in formulas or PivotTables.

There are many ways to fix dates formatted as text in Excel and the method you choose will depend partly on the format they’re in and partly based on your preference for a formula or non-formula solution.

Tip: You can often tell that a number or date is incorrectly formatted as text because it is aligned to the left. The default alignment for text is left and numbers and dates are aligned right.

Note: since I’m in Australia our dates are formatted dd/mm/yyyy so I’ll be using this format in the following examples.

Jump to Section

  • 1. VALUE Function
  • 2. DATEVALUE Function
  • 3. Find & Replace
  • 4. Text to Columns
  • 5. VALUE & SUBSTITUTE Functions
  • 6. Error Checking
  • 7. Bonus — Power Query

1. VALUE Function

Syntax:

=VALUE(text)

Where the ‘text’ is the reference to the cell containing your date text string.

The VALUE function was included in Excel for compatibility with other spreadsheet programs, and I’m glad it was cause it’s handy.

It can convert any text string that looks like a number into a number, so it’s useful for fixing any number, not just dates.

Excel Convert text dates with the VALUE function

Tip: What’s also useful about the VALUE function is it will convert a cell containing date and time that is formatted as text, as you can see in row 7 above where 2014-1-1 8:00 became 41640.3333, which is the Excel serial number for the date and time: 1/01/2014 8:00 AM, whereas the DATEVALUE function, which we’ll look at next, ignores the time portion of the text string.

Notes:

  1. If your text string isn’t in a format recognised by Excel it will return the #VALUE! error.
  2. Excel will return the serial number for your date, you will then need to format the cell with a date format to make the serial number ‘look’ like a date as I have done in column E above.

2. DATEVALUE Function

Syntax:

=DATEVALUE(date_text)

Where ‘date_text’ is the reference to the cell containing the date text string.

DATEVALUE is very similar to the VALUE function except it only converts a text string that looks like a date to a date serial number. It can’t handle any old text string that happens to look like a number, for that you need the VALUE function.

Excel Convert text dates with the DATEVALUE function

Notes:

  1. Time information in date_text is ignored, as you can see in row 13 above where the result is the date portion only.
  2. If the year portion of date_text is omitted, DATEVALUE uses the current year from your computer’s built-in clock as you can see in row 15 above.
  3. Using the default date system in Excel for Windows, date_text must represent a date from January 1, 1900, to December 31, 9999. Or, in Excel for the Macintosh, date_text must represent a date from January 1, 1904, to December 31, 9999. DATEVALUE returns the #VALUE! error value if date_text is out of this range.

3. Find & Replace

If your dates have decimal places as delimeters then VALUE and DATEVALUE are of no use to you, for example dates like this:

1.01.2014

This is where Find & Replace is a great option.

Using Find and Replace to replace the decimal with a forward slash converts the text string to an Excel serial number in one fell swoop.

To use Find & Replace:

  1. Select all the dates you want to fix
  2. Press CTRL+H to open the Find & Replace dialog box<
  3. Enter a decimal place in the ‘Find what’ field, and a forward slash in the ‘Replace with’ field
  4. Click ‘Replace All’:

Excel Convert text dates with the Find and Replace

Excel should detect that your text is now a number and format it automatically as a date. If that doesn’t work, you can try the next tool; Text to Columns.

Tip: You can also use Find & Replace to fix date text strings with other delimiters like spaces, or the hyphens we saw in the VALUE and DATEVALUE examples. Just enter a space or hyphen in the ‘Find what’ field instead of the decimal place.

4. Text to Columns

Personally I love Text to Columns. It is one of the most versatile tools for fixing data imported from other systems. I’m going to show you how to fix dates with it now, but I recommend you take some time to play around with the other options it offers.

So, if your dates are formatted in text strings like this:

Excel date text strings

You can use Text to Columns to quickly reformat them all.

Simply select your dates in column A > Data tab of the ribbon > Text to Columns to open the Wizard:

Excel text to columns tool

Step 1 of the Wizard: Choose ‘Delimited’

Step 2 of the Wizard: uncheck all Delimiters (just to be safe)

Step 3 of the Wizard: Choose ‘Date’ from the ‘Column Data Format’ options and choose your date format from the drop down list (my dates are YMD), and click the Finish button:

Excel text to columns wizard to fix dates formatted as text

Tip: Note how the ‘Date’ drop down list above has many different combinations of D M Y, you simply choose what order your dates are formatted in from the list.

This means you could have also used Text to Columns to fix the dates we looked at with VALUE and DATEVALUE that had hyphens, or even decimal place delimiters, or for example if your dates are text strings like these:

Jan 1 2014
Jan 2 2014 etc.

You’d simply choose MDY from the drop down list in step 3 of the wizard to fix the dates above. Versatile eh?

Now, while Text to Columns is pretty powerful, it has its limits. For example if your dates are formatted like this:

Wednesday, January, 1, 2014

You need to put in a bit more effort. Here is a tutorial where I use both Text to Columns and the DATE function to fix the above date format.

VALUE and SUBSTITUTE Functions

If you prefer a formula solution to the Find & Replace or Text to Columns options above, then you can use the VALUE function with SUBSTITUTE on stubborn dates that use delimiters like decimals:

fix dates formatted as text with VALUE and SUBSTITUTE functions

The syntax for SUBSTITUTE is:

=SUBSTITUTE(text, old_text, new_text, [instance_num])

So, you can see in the above examples we are using SUBSTITUTE as our ‘text’ argument in the VALUE function to replace the decimals with forward slashes, just like we did with Find & Replace.

The VALUE function then converts the output of SUBSTITUTE to an Excel serial number.

Tip: We have omitted the ‘instance_num’ argument in SUBSTITUTE as we want to replace all of them.

Error Checking

Now, Excel is pretty clever (and I’m not just saying that because I love it 😉 ); it has inbuilt error checking that is always on the lookout for numbers formatted as text.

You can tell if it has spotted an error because it will have a small green triangle in the top left of the cell and if you select the cell an exclamation mark will appear:

Excel error checking to fix dates formatted as text

Clicking on the exclamation mark will reveal some options relevant to your text:

Excel error checking to fix dates formatted as text

In this case the dates above only have a 2-digit year so Excel is asking me what format I want to convert it to; 19XX or 20XX.

You can quickly fix all dates using the error checking by selecting all of your cells containing date text strings before clicking on the Exclamation mark on the first selected cell.

Turn on Error Checking

To make sure Error Checking is turned on go to Excel Options > Formulas > and make sure the following options in orange are checked:

how to turn on Excel error checking

So, there you have 6 different ways to convert dates formatted as text in Excel. There are many more ways with formulas, but the above should allow you to handle almost any permutation quickly and easily.

p>

Bonus — Power Query to Fix Dates

The video below runs through 5 common date formatting problems and illustrates how easy it is to fix them with Power Query. The bonus with Power Query is that you can refresh the query to get new data and have it automatically fix those dates too.

Subscribe YouTube

Download Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.

Понравилась статья? Поделить с друзьями:
  • You are cleansed by the word
  • Yes type of word
  • Yes to you spoken word
  • Yes time and the word
  • Yes time and a word скачать альбом