Forum Discussion

SuziieeWuziiee's avatar
SuziieeWuziiee
Copper Contributor
Mar 08, 2022
Solved

PowerQuery - Editing / Replacing Values

Hello Excel community! I am very new to Excel PowerQuery and I would really appreciate if you can help me with solving the issue below. So I have imported the dataset to PowerQuery, all good. Obvio...
  • Martin_Weiss's avatar
    Mar 08, 2022

    Hi SuziieeWuziiee 

     

    that's right, you cannot edit individual cells in Power Query.

    One option (you named it already), would be to fill the missing cities already in the data source, before you load it into Power Query.

    If that's not possible (e.g. data comes from an external database) and the information is also included in another field (le.g. in the State field), then you can try to extract it from there.

     

    How to do it in detail depends on the pattern that you have in the other field. I understand that some of the states include the city name and some don't.

    Let's say the state contains the city and it's separated by a comma from the state:

    Split the column by delimiter and use the comma as delimiter:

    Then add a new conditional column:

    If the existing City column is not empty, it takes that value. Otherwise it takes the value of the State.1 column.

    Then add another conditional column:

    Finally, delete the old columns and rename the new ones.

     

    Hope, this helps a bit.

     

     

     

Resources