Powerpivot formulas break when source is blank

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
I have some Powerpivot tables with calculated fields doing simple things like SUM... if my source table happens to be empty on refresh, I get an error message that SUM takes an argument of numbers and cannot evaluate a String. Is there something I can add to my formula to catch this? I tried wrapping it in IFERROR but it still doesn't help.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I'm surprised this happens... but don't have time to look into it right now. Easiest solution is probably IF (COUNTROWS(TableName) > 0, ...
 
Upvote 0
I've found that the issue is that, when the columns being summed are blank, the data type changes to Text, so the formula results in an error because it reads that as a string and SUM accepts numbers.

But even if I manually change it from Text to Number, it changes back to text the next time the cells become blank.

Is there a way to permanently set the Data Type and prevent Power Pivot from changing it?
 
Upvote 0
Couple thoughts come to mind.
1) there are differences whether you refresh a PowerPivot table from the ribbon: Home/Refresh vs. Design/TableProperties/Save. Based on my experience Home/Refresh will not change data types on import. Design/TableProperties/Save will change data types. Do you experience your issue with both types of refresh???
2) You didn't mention your data source type. I'm guessing it is the Text Import wizard or similar, which will type cast on the fly if there is no schema.ini present. If this is the case, it can be remedied by simply creating a schema.ini file & editing it to specify the data type. The steps are detailed here.
 
Upvote 0

Forum statistics

Threads
1,224,061
Messages
6,176,150
Members
452,707
Latest member
laplajewelry

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