I have county data in which the "FIP"s (actually State "FIP"s and County "FIP"s combined). I have data imported as CSV with the sames "FIP"s data titled 'STCounty'. However, the shapefile "FIP"s is listed as a Real and the CSV came in as an Integer and the Join function does not seem to work. The drop boxes are greyed out/empty.

So the bigger questions is how do you change the attribute type in a table?

I tried to create a new column in the shapefile (county data) and set it to an integer and then multiply the "FIP"s*1, but got a column full of NULL.

I am new to QGIS and have a lot of experience in MapInfo, so the join concept is not new to me, just the syntax in QGIS.

4 Answers 4


Creating a new integer column is the right way to go - but the 1*FIPS that you used (which would work in Excel or Libreoffice) is where the problem comes in; QGIS doesn't automatically convert between field types in a calculation.

You need to use one of the conversion functions (toint converts to integer, tostring to text, and toreal to real/decimal) with the correct column name:


You can use the Tablemanager plugin to then remove unnecessary columns.

Setting up a .csvt file would be the best repeatable solution but for a single column, this should be pretty straightforward.

  • The 1*FIPS also works in ArcGIS.
    – L_Holcombe
    Commented Nov 5, 2012 at 20:28
  • seems kind of silly not to be able to just change the datatype. However, this does seem to be the correct answer
    – chrismarx
    Commented Mar 28, 2014 at 19:15

I once answered this question,

If you import your Data from a csv file you need to create a csvt file in order to determine the attribut type of a field.

See the explanation here: Changing CSV layer attribute value from text to number in QGIS?


I just had the same problem. In my case i work with Libreoffice and QGIS.

I exported a table from R to .CSV with two columns: "id" and "veh". "id" is Integer and "veh" Real.

write.csv(tab2,file='/path/table.csv',row.names = F)

When i open the table.csv in Libreoffice the field veh was read it as "string". So i created another coulmn "vehh" as the multiplication of "veh"*1, and the result was the desired number . Then i saved the file as .ODS (Libre Office)

Then i load the table.ODS in qgis and "vehh" was recognized as Real.


I stumbled upon this and it took me a while to find out that there's a much better, more up-to-date answer to this problem: nowadays, you can use the Table Refactor Field Tool from QGIS standard toolbox, it works much better and it's easier.

Basically you go in the toolbox, find the Refactor Fields tool, and the popup menu allows you to change the datatype of each field

Table Refactor Field Tool

See this link for a step-by-step explanation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.