Let’s say you have two lists of values in Excel and want to find out all the common values (ie duplicates) and extract them. In this article, let me explain the formulas for this.

Formula for counting number of duplicate values in two columns:
Here is the formula to count number of common values between two columns.
=COUNT(XMATCH(D4:D20,B4:B16))
'Generic formula pattern
=COUNT(XMATCH(list2,list1))How does this formula work?
The XMATCH(list2, list1) finds the position of every item in list2 in list1. Then it returns an array of these positions (or #N/As if the value is not in the other list).
COUNT(XMATCH(..)) simply counts the numbers in these positions. So the errors are ignored and we get the count of common values.
Limitations of this formula
The above formula requires XMATCH function, which is available only in Excel 365 and Excel online. If you are using an older version of Excel, refer to this page for alternative approaches.
Extracting the duplicate values between two columns with Excel formula
We can use the same approach to find all the duplicate values and extract them as a list. Here is the formula for that.
=LET(arr, XLOOKUP(B4:B16,D4:D20,D4:D20,""),FILTER(arr, arr<>""))
'generic formula pattern
=LET(list1, <range goes here>, list2, <range goes here>,
arr, XLOOKUP(list1,list2,list2,""),FILTER(arr, arr<>""))Formula Explanation
Let’s go inside out.
- XLOOKUP(B4:B16,D4:D20,D4:D20,””): This lookups every item in the first list against second list and returns the value from second list if found and blank space other wise. [related: learn more about XLOOKUP]
- LET(arr, XLOOKUP(..): We store the xlookup output (which would be an array the size of first list) in to a variable called arr.
- FILTER(arr, arr <> “”): We take the output of the xlookup, which is stored in the variable arr and remove any blank values (ie the value is not in the second list).
Here is the sample output of both of these formulas (counting duplicate values and extraction of duplicate values).

Download Example Workbook
Click here to download the sample workbook with these formulas. Play with the data & formulas to learn how they work.
Other ways to extract duplicate values from two columns:
You can also use Excel features like pivot tables, power query or conditional formatting to deal with this issue. Refer to below pages for the explanation of these powerful techniques.

















8 Responses to “Top 5 keyboard shortcuts for Excel Charts”
As far as I remember (checked, again, 2 minutes ago) in my "Excel 2013" in order to select various chart elements I need to use the Arrow keys and not the TAB key.
Practically, the TAB key does nothing (within a Chart).
----------------------------
Michael (Micky) Avidan
Thanks for pointing this out. This is how I remember it too, but when I was recording the video yesterday, only TAB key worked. MS must have changed the keys in Excel 2016. I have edited the post to include both keys.
The key navigation on charts is different in 2016.
TAB cycles through a layer of objects (SHIFT+TAB cycles backwards)
ENTER move down a layer
ESC moves up a layer
So on a column chart with title/legend/data labels if you select the plotarea the TAB will go through Title > Legend > Plotarea.
ENTER at plotarea will then select Vertical axis. Tab will take you through
Horizontal axis > gridlines > Series > Horizontal Axis.
ENTER with series selected will then allow you to TAB through individual data points and data labels.
If you ENTER on datalabels you can TAB through each data label.
ALT + F1 : to create default chart
ALT+E S T = CTRL + ALT + V, T : I find that easier to remember
I second what Michael already said about TAB and arrow keys. I can't help but think if this is related to the "," or ";" as separator. I prefer to use the chart tools - layout- drop down box, anyway.
Got to be F11 for instant charting. Highlight your data , hit F11 and voila! ?
Ctrl+1 is the most important chart shortcut. In fact, it works for any Excel object: whatever is selected, Ctrl+1 opens the task pane or dialog to format that object.
Somewhere along the line, maybe when Excel 2016 came out, the arrow keys stopped working to cycle through the elements of a chart. But what works is holding Ctrl while clicking the arrow keys. I haven't gotten used to the Tab and other keys, but as long as Ctrl+Arrow works, I'm good.
And F4 used to be so helpful when formatting a lot of charts. But since Excel 2007 came out, it has been mostly useless. It used to remember a whole set of changes at once, so I get that the newer modeless dialogs make that impractical. But now it only seems to work with formatting of lines and borders, and maybe fills. I find myself writing a lot of VBA one-liners in the Immediate Window to handle these tedious formatting tasks.
after clicking on a chart, is there a shortcut key to copy it?
Thank you for the Alt E S T - tip. This is more than a time saver. Because of dynamic charts or de-activated external references to data when you make the charts, you often have empty charts that are otherwise impossible to format. So this shortcut helps adressing that. I will work with it more and see if there remain some obstacles.