Home » excel » Excel function doesn't evaluate in an exported file

Excel function doesn't evaluate in an exported file

Posted by: admin April 23, 2020 Leave a comment


I’m creating an xlsx file on the server (Ruby, axlsx gem) with cells connected to an API using the =WEBSERVICE function.

When I open the file instead of values excel shows “#NAME?” as if the function cannot be found. If I click on the formula bar, change nothing and click back anywhere in the spreadsheet – the value is calculated properly. Furthermore – if I save the file and reopen it the cells I’ve touched will display, while others won’t.

What am I missing here?

Example formula:
=WEBSERVICE(“https://finstate.net/api_text/LOOP-“&”q1-2020″&”/Balance Sheet/current liabilities current portion of long-term debt”)

Thanks in advance…

How to&Answers:

I’ve run into that problem when the format being applied to the cell is messed up. Look at the format of a cell displaying “#NAME?” and see if it automatically changed the format for one of the cells that you click on that are now displaying properly. If so, then you can select the entire column containing the formulas and update their format accordingly. If there’s no difference in format, I would still try updating the format of the cells to see if that helps. I would start with switching to General format even if it says that’s the format already.

If the above doesn’t work, I have also resolved such a problem using the “Text To Columns” operation from the Data tab. Highlight the problematic row, click Text to Columns, then click Finish without changing anything.

Edit: You can implement the Text to Columns solution with VBA by specifying the parsing type as delimited, but setting all the delimiters to false. Example subroutine:

Sub test()
    Range("A:A").TextToColumns DataType:=xlDelimited, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False
End Sub