+ Reply to Thread
Results 1 to 6 of 6

Power Query Add index number to existing column

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    615

    Power Query Add index number to existing column

    Hi,
    is there a way to add a number to the values of an existing column without using Add index and a combine columns,

    I've been trying to save the index as a variable in a let statement,

    What i have so far is ;

    Please Login or Register  to view this content.

    Any ideas?

    Richard.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Power Query Add index number to existing column

    Do you mean adding a number to the END of a string or ADDING it to a number? There is Format > Add Suffix - maybe?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    615

    Re: Power Query Add index number to existing column

    I'm afraid , that won't work, I want the an index so if a i have " ab , ac, ad, abc, de " become " ab1, ac2, ad3 abc4, de5 " , etc.

    I have thought about using list.zip, but have not got around to trying it, will update if it works.


    Richard.

  4. #4
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    615

    Re: Power Query Add index number to existing column

    Just had a go with zip and it does work, just not sure it's any shorter

    and index and column list zipped ;

    Please Login or Register  to view this content.


    and then put them together;

    Please Login or Register  to view this content.

    Richard.

  5. #5
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Power Query Add index number to existing column

    Your first approach is generally a fast way of doing this. List.Transform is iterating over all all items in a list, which will take longer on larger datasets.
    You are using two list.transforms in the last solution.

    Take the solution with an index column

  6. #6
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    615

    Re: Power Query Add index number to existing column

    Sorry, not quite sure which you mean is more efficient, I first used Add index column then a combine and in the second zip,
    I had to use a transform on both to join text and number,

    In the first method, is it possible to create a virtual columns of index numbers and then combine that to to the text values rather than a 'real' one,
    this is what I initially was trying to do but gave up,



    Richard.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Use Row/Index number as Variable in Power Query
    By ptmuldoon in forum Office 365
    Replies: 3
    Last Post: 11-06-2023, 06:03 PM
  2. [SOLVED] Power Query: Add a new query to an existing Query that already has multiple queries
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-06-2023, 04:33 PM
  3. Replies: 14
    Last Post: 01-11-2022, 10:55 AM
  4. Power query positional index operator for column
    By Dicken in forum Office 365
    Replies: 0
    Last Post: 11-04-2021, 12:11 PM
  5. [SOLVED] Power Pivot/Query Convert Existing Table to Query
    By trisoldee in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-23-2019, 04:27 PM
  6. [SOLVED] Power Query Custom Column: If number in columns a or b are less than 1 then 0 else 1
    By jekeith in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-15-2018, 10:31 AM
  7. Replies: 2
    Last Post: 05-22-2017, 11:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1