Hi everyone, over the last few weeks we have had a series of posts to show you some of the things that are possible to do with Copilot in Excel. This week, we will showcase how Copilot in Excel can help create a formula to calculate distinct values.
In this example, we are given a table of event locations and we'd like to figure out a formula to count each distinct location.
Given the values that are returned, let's find out how many location are listed:
How many distinct locations are there?
Analyzed data in B2:C156 returns:
Distinct Count of Location |
50 |
Copilot said:
There are 50 distinct locations.
Copilot returns an answer of 50, but I would like to have a formula that updates as the list changes. A coworker suggested the formula below, but I don’t understand it. I ask copilot:
A coworker gave me this formula to calculate the distinct locations, can you tell me how it works: =SUM(--(FREQUENCY(MATCH(C:C, C:C, 0), MATCH(C:C, C:C, 0)) > 0))
This formula calculates the number of distinct locations in column C. Here's how it works:
I understand the formula, but it seems overly complicated. I’d like to see if Copilot can do better. I ask:
Can you simplify the formula?
Yes, I can simplify the formula. Here is a more straightforward way to count distinct locations using the UNIQUE and COUNTA functions:
=COUNTA(UNIQUE(Table19[Location]))
That is much simpler! I copy the formula from the copilot pane and copy into my workbook. Now when I make changes to the table, the unique location count updates automatically.
Here are some additional examples from the last six weeks if you missed them:
Stay tuned,
Microsoft Excel Team
*Disclaimer: If you try these types of prompts and they do not work as expected, it is most likely due to our gradual feature rollout process. Please try again in a few weeks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.