Excel Unplugged

AI in Excel – Part 2 – Column From Examples

Welcome back to Artificial Intelligence in Excel! In Part 1, we’ll looked at a feature called Flash Fill. It works by recognizing patterns of data and filling out the remainder. In Part 2, we’ll look Power Query’s Column From Examples command. It’s similar to Flash Fill: it fills in the rows based on the input we provide. However, it has a great advantage over Flash Fill: it’s dynamic. Column from Examples command actually constructs a formula based on the initial data. If the input data changes, the filled in data changes too!

Let’s see how it works.

Column From Examples command

Let’s start with a simple base table of data.

AI in Excel - Part 2 - Column From Examples, Base table
Starting data table

We load the table to Power Query by selecting Data > From Table/Range.

In Power Query we select Column From Examples.

AI in Excel - Part 2 - Column From Examples
Power Query: Column From Examples

First name in capital letters

Let’s first try to get a column with first name in capital letters and last name as is. We select Column From Examples and fill out the first row. We get the suggestion for completing the other rows and we can see it matches the result we want.

AI in Excel - Part 2 - Column From Examples, First name
First name in capital letters, last name as is

We simply confirm with OK.

Before confirming, let’s just observe what Power Query did: it constructed a formula based on our input. This formula will be used to fill our the entire column. It’s correctly assumes it has to use the Name column in capital/upper letters, the Last Name column and combine the two.

AI in Excel - Part 2 - Column From Examples, Constructed formula
Constructed formula

If anything in the column Name of Last Name changes, it will also change in the new Merged column. This wouldn’t happen with Flash Fill. Just Brilliant!

Name of the Month

Let’s try something else Flash Fill can’t do: getting month name from date column

Select Column From Examples and type in October. We see the suggestions match the name of the month from Date of Birth column. It’s also clear from the constructed formula that it works as we wanted.

AI in Excel - Part 2 - Column From Examples, Month name
Name of the Month

This way we could get the year, day and many more information based on other column. We can see the available answers if we just start filling out the first row. There are multiple types of information available.

AI in Excel - Part 2 - Column From Examples, Data available
Available outputs

Let’s use Week of Year.

AI in Excel - Part 2 - Column From Examples

Address number

Another example is address number. We again select Column From Examples and provide the first value, 251.

AI in Excel - Part 2 - Column From Examples, Address number
Address numbers with unwanted text

We see the last two rows include some text we don’t want. What we can do is simply fill out the third row, and Power Query now understands we’re only interested in the number.

AI in Excel - Part 2 - Column From Examples, Address number
Address numbers

Confirm the data with OK.

We finish by using Close & Load to load the finished table to Excel.

AI in Excel - Part 2 - Column From Examples, Finished table
Finished table

In conclusion, we have demonstrated how Column From Examples works. With that you now have another brilliant tool in your toolbox!

Watch the tutorial

Meanwhile, you can also watch the tutorial online on our new YouTube channel!

AI in Excel – Part 2 – Column From Examples

Please leave us a like, comment, and subscribe for more amazing Excel tricks!

Follow us on LinkedIn.

Check out our brand new R Academy!