Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
RobRayborn
Helper IV
Helper IV

Excel Files with Custom Date Formats

I receive Excel Workbook daily that are placed into a SharePoint file by an offsite source. 
Within the sheets of these files are columns of Dates.  Those Date Columns are formatted as, _(* #,##0_);_(* (#,##0);_(* "-"??_);_(@_)

 

If found a mistake made by this offsite source where they accidently put the incorrect date into the Date column 03/01/2024 and should have been 03/01/2023.  This mistake is found within all the sheets for this month.

When I went to correct the date manually by enterine 03/01/2023 the date turned into the Whole Number form of that date.

This now breaks my Power Query upload of this SharePoint Folder, as it [DataFormat.Error] We couldn't parse the input provided as a Date value.

New files arrive daily with the Date Column having the format of _(* #,##0_);_(* (#,##0);_(* "-"??_);_(@_), and these are pulled into Power Query as Text and are easily Changed to Date Type.

How can I get the date column of these 31 files to work with the untainted files from the rest of the year?

 

1 REPLY 1
freginier
Solution Sage
Solution Sage

The format string you pasted is an Excel display number format (it's actually an accounting format), and Power Query ignores cell display formatting entirely - it reads the underlying stored value. So the real issue is a mixed-type column: most cells are stored as text dates, but the one you re-typed by hand became a real Excel date, which is stored as a serial number. The column now mixes text and number, so a single "Change Type to Date" hits a value it can't parse and throws the [DataFormat.Error].

 

Handle both kinds in one step instead of a blanket type change. Add a custom column:

 

= if [DateCol] is number then Date.From([DateCol])

  else if [DateCol] is text then Date.FromText([DateCol], [Format="MM/dd/yyyy", Culture="en-US"])

  else null

 

Set that column to type Date and remove the original one. Date.From on a number reads it as the Excel date serial, and Date.FromText (with the right Culture) handles the text ones - so the 31 "corrected" files and the untouched files all parse, and it keeps working as new files arrive.

 

(Adjust the Format/Culture to match how the text dates actually look in your files.)

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.