Member_2_7966563
asked on
Excel External Data (numerical) shows up as text
I have a link in an Excel spreadsheet to get external data from an MS Access database, containing a query. This query produces some fields containing numerical values.
But when the data is downloaded into Excel, it is treated as text with zero value. If I calculate another cell using these values, the value of the calculated cell is always zero.
My workaround has been to copy a "1" and paste special - multiply on all of these columns. From that point onwards, they start behaving as numbers and the calculated cells become alive.
The workaround is tedious and I have to do it again and again. How can I do it more elegantly?
But when the data is downloaded into Excel, it is treated as text with zero value. If I calculate another cell using these values, the value of the calculated cell is always zero.
My workaround has been to copy a "1" and paste special - multiply on all of these columns. From that point onwards, they start behaving as numbers and the calculated cells become alive.
The workaround is tedious and I have to do it again and again. How can I do it more elegantly?
If the Access query includes calculated values, it is possible that the method used is generating text strings rather than actual numeric values. Try fixing the query.
ASKER
I tried to force the column to produce numerical outputs by using the VAL and FORMATNUMBER functions. But they were still imported into Excel as text anyway. How else could I fix the query?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It comes from access. Check if there the column defined as number format from .access table column.
Just so you know, if you use the NZ( ) function in a query, it will always return a string value, even if the value you provide is numeric. You can see this by looking at the results of the query, you will see that the numbers are left aligned, instead of right. If you wrap that in Val( ) or one of the numeric conversion functions, as Pat mentioned above, it should properly convert it to a number which will export properly to Excel.
ASKER
It solved the problem
if the data type you are querying may contain not only numbers but regular characters than you need to convert the values after they are imported to Excel.
You could also try some suggestion from this thread: https://www.experts-exchan