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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gilberttanjh
New Member

Data Format.Error Invalid Cell Value #REF!

Hi all,

 

I have a power query that aggregate the data from 21 excel files into 1 excel file. Recently during a data refresh, i kept getting the error - Dataformat.error Invalide cell value "#Ref!". I went back to all the 21 excel files but still cannot find the cell with that error value. Is there a better way that i can narrow down this error to resolve it? I read on the forum to duplicate the query and remove all steps except the source and navigation steps. Appreciate if someone can point me to what are the source and navigation steps per below picture.

 

Thanks.

 

Capture.JPG

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @gilberttanjh 

 

When you refresh in desktop and a query returns an error that it can handle, you  would normally get the kind of screen below. Clicking on the view errors will create a query showing all rows with errors only and which columns.

danextian_0-1735200869732.png

danextian_1-1735200957595.png

If you weren't prompted, try this query:

let
 //name of the query with errors, if there are characters under than an underscore the format should be #"Sheet 1" for a query named Sheet 1
Source = Sheet1,
  #"Detected Type Mismatches" = let
    tableWithOnlyPrimitiveTypes = Table.SelectColumns(Source, Table.ColumnsOfType(Source, {type nullable number, type nullable text, type nullable logical, type nullable date, type nullable datetime, type nullable datetimezone, type nullable time, type nullable duration})),
    recordTypeFields = Type.RecordFields(Type.TableRow(Value.Type(tableWithOnlyPrimitiveTypes))),
    fieldNames = Record.FieldNames(recordTypeFields),
    fieldTypes = List.Transform(Record.ToList(recordTypeFields), each [Type]),
    pairs = List.Transform(List.Positions(fieldNames), (i) => {fieldNames{i}, (v) => if v = null or Value.Is(v, fieldTypes{i}) then v else error [Message = "The type of the value does not match the type of the column.", Detail = v], fieldTypes{i}})
in
    Table.TransformColumns(Source, pairs),
  #"Added Index" = Table.AddIndexColumn(#"Detected Type Mismatches", "Row Number" ,1),
  #"Kept Errors" = Table.SelectRowsWithErrors(#"Added Index", {"ColumnA", "ColumnB", "ColumnC", "ColumnD"}),
  #"Reordered Columns" = Table.ReorderColumns(#"Kept Errors", {"Row Number", "ColumnA", "ColumnB", "ColumnC", "ColumnD"})
in
  #"Reordered Columns"

You can right click the header of the column with errors and replace the values enrror with null, remove the erring rows or fix the data source.

danextian_3-1735201277868.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
v-tsaipranay
Community Support
Community Support

Hi @gilberttanjh ,

Thanks for reaching out to the Microsoft fabric community forum.

 

As per @danextian   posted answer those are the troubleshooting steps to resolve your issue.

 

In the image you referred to, it appears that only the source is shown, without any navigation steps. The rest of the content consists of applied steps. By examining the applied steps in the image, we can't identify the exact error that is occurring.

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

 

Thank you.

Hi @gilberttanjh 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please 'Accept it as a solution' and give a 'Kudos' so other members can easily find it.


Thank you.

Hi @gilberttanjh,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

Hi @gilberttanjh,

 

I wanted to follow up on our previous suggestions regarding the error - Dataformat.error Invalide cell value "#Ref!". We would love to hear back from you to ensure we can assist you further.

If my response has addressed your query, please accept it as a solution and give a ‘Kudos’ so other members can easily find it. Please let us know if there’s anything else we can do to help.

 

Thank you.

 

danextian
Super User
Super User

Hi @gilberttanjh 

 

When you refresh in desktop and a query returns an error that it can handle, you  would normally get the kind of screen below. Clicking on the view errors will create a query showing all rows with errors only and which columns.

danextian_0-1735200869732.png

danextian_1-1735200957595.png

If you weren't prompted, try this query:

let
 //name of the query with errors, if there are characters under than an underscore the format should be #"Sheet 1" for a query named Sheet 1
Source = Sheet1,
  #"Detected Type Mismatches" = let
    tableWithOnlyPrimitiveTypes = Table.SelectColumns(Source, Table.ColumnsOfType(Source, {type nullable number, type nullable text, type nullable logical, type nullable date, type nullable datetime, type nullable datetimezone, type nullable time, type nullable duration})),
    recordTypeFields = Type.RecordFields(Type.TableRow(Value.Type(tableWithOnlyPrimitiveTypes))),
    fieldNames = Record.FieldNames(recordTypeFields),
    fieldTypes = List.Transform(Record.ToList(recordTypeFields), each [Type]),
    pairs = List.Transform(List.Positions(fieldNames), (i) => {fieldNames{i}, (v) => if v = null or Value.Is(v, fieldTypes{i}) then v else error [Message = "The type of the value does not match the type of the column.", Detail = v], fieldTypes{i}})
in
    Table.TransformColumns(Source, pairs),
  #"Added Index" = Table.AddIndexColumn(#"Detected Type Mismatches", "Row Number" ,1),
  #"Kept Errors" = Table.SelectRowsWithErrors(#"Added Index", {"ColumnA", "ColumnB", "ColumnC", "ColumnD"}),
  #"Reordered Columns" = Table.ReorderColumns(#"Kept Errors", {"Row Number", "ColumnA", "ColumnB", "ColumnC", "ColumnD"})
in
  #"Reordered Columns"

You can right click the header of the column with errors and replace the values enrror with null, remove the erring rows or fix the data source.

danextian_3-1735201277868.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.