I have field values that are:

  • OG_S_G4,
  • OG_S_G3,
  • OG_S_G2, etc.

and I want to change the OG to LIP whilst keeping all the text after (i.e. LIP_S_G4), is there a way to do this?

2 Answers 2


Create a new field with a type of text (string), and in the field calculator just use the following expression in a new field:


where the fieldName is the name of the field that holds the texts OG_S_G4, OG_S_G3, OG_S_G2

enter image description here


You can add a new column using the field calculator in the attribute table of your data.

enter image description here

Using the following code you can add new data labels based on existing ones.

  WHEN "column_name"= 'OG_SG4' THEN 'LIP_S_G4'
  WHEN "column_name"= 'OG_SG3' THEN 'LIP_S_G3'
  WHEN "column_name"= 'OG_SG2' THEN 'LIP_S_G2'

Make sure that you set the correct output field type, in this case "Text (string)".

enter image description here

  • 1
    Thank you to the two people who answered my question, really helped!!!!
    – kel
    Sep 12 at 0:32

Your Answer

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

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