Microsoft Query data type incorrect

DaKen

Board Regular
Joined
Feb 18, 2002
Messages
55
I have an Excel spreadsheet where I'm pulling data from a CSV file using Microsoft Query. One of the fields is an invoice #. Most of the invoices are all numeric (34046), but some have an alpha character after the # (34046A). The query pulls all the numeric values fine, but the ones with the alpha character don't pull at all.
I'm assuming that the query is assuming it is a numeric field and doesn't recognize the alpha character and skips it.
How can I fix it to pull all the data?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
What happens if you use Data>From Text/CSV... to import the data?

That should fire up the Import Wizard where you can specify the data type of the Invoice# column as Text.
 
Upvote 0
I need to use the query method to allow me to adjust some columns and do some calculations. The text method doesn't allow that.
 
Upvote 0
Have you considered using Data>Get and Transform...?

That would allow you to import the data from the CSV, perform adjustments/calculations and return the results to Excel.
 
Upvote 0
I’m not familiar with that. It sounds like a few extra steps, but I’ll have to give it a look see.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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