How do I invoke a custom function for dynamic columns?
01:39 28 Jan 2026

I'm making signage, and I have a separate table where the length of each uppercase letter, lowercase letter, and character are recorded in inches. I also have a table with names, which will be the content for the signage. I've set it up so that the "Name Column" will dynamically split into columns called "Word " & a number. Some names will have more words than others, so it's important that this is dynamic.

Name Word 1 Word 2 Word 3
Barb Allen Smith Barb Allen Smith
Andrew Cook Andrew Cook null
Jessica Banks Jessica Banks null

I made a custom function to find the length of a word, based on the sizes listed in that separate table, with parameters for a filter table, filter column, and filter word. If I apply this custom function to a single column, it works exactly as needed.

Here is my current code in Power Query for that:

#"Sorted Rows" = Table.Sort(#"Seperate Main Words",{{"Index", Order.Ascending}}),

    #"Invoked Custom Function" = Table.AddColumn(#"Sorted Rows", "Query1", each Query1(#"Sorted Rows", "Word 1", [Word 1]))

I need to apply this custom function to all of the columns that were created dynamically, but I don't know how to do so. I've tried referencing a list of column names in place of "Word 1" but that doesn't work.

Any ideas?

excel powerquery m custom-function dynamic-columns