## List all unique events in a month

*Article updated on February 16, 2018*

**Question:**

I have a table with four columns, Date, Name, Level, and outcome. The range is from row 3 to row 1000.

What I need to be able to do is look at today's date. Determine the month and year and then look up all the values in the date column that match the month and year. I've been trying to get it to work with sumproduct but I can't wrap my head around it.

Then on a separate tab list all the unique events for that month.

So one the seperate tab it would show something like this:

May 2/2010 Bob Smith 3 Requires Attention

May 5/2010 Jim Smith 1 Out of Service

Hope you are able to help. Thanks in advance.

**Answer:**

### Match year and month

**Array formula in A14:**

Copy cell and paste it to the right to D14. Copy A14:D14 and paste it down as far as needed.

### List all the unique distinct events for that month

**Array formula in A23:**

Copy cell and paste it to the right to D23. Copy A23:D23 and paste it down as far as needed.

### How to create an array formula

- Select cell A23
- Copy/Paste array formula to formula bar
- Press and hold Ctrl + Shift
- Press Enter

### Explaining array formula in cell A23

**Step 1 - Find matching months and years**

DATE(YEAR($C$2), MONTH($C$2), 1)=DATE(YEAR($A$5:$A$9), MONTH($A$5:$A$9), 1))

becomes

DATE(YEAR(40303), MONTH(40303), 1)=DATE(YEAR({40290;40285;40300;40303;40300}), MONTH({40290;40285;40300;40303;40300}), 1))

becomes

DATE(2010, 5, 1)=DATE({2010;2010;2010;2010;2010}, {4;4;5;5;5}), 1))

becomes

40299={40269;40269;40299;40299;40299}

and returns

{FALSE;FALSE;TRUE;TRUE;TRUE}

**Step 2 - Find unique distinct records**

This COUNTIFS formula avoids duplicate records. It uses absolute and relative cell references.

COUNTIFS($A$22:$A22, $A$5:$A$9, $B$22:$B22, $B$5:$B$9, $C$22:$C22, $C$5:$C$9, $D$22:$D22, $D$5:$D$9)

returns

{0;0;0;0;0}

**Step 3 - Add arrays**

NOT(DATE(YEAR($C$2), MONTH($C$2), 1)=DATE(YEAR($A$5:$A$9), MONTH($A$5:$A$9), 1))+COUNTIFS($A$22:$A22, $A$5:$A$9, $B$22:$B22, $B$5:$B$9, $C$22:$C22, $C$5:$C$9, $D$22:$D22, $D$5:$D$9)

becomes

NOT({FALSE;FALSE;TRUE;TRUE;TRUE})+{0;0;0;0;0}

becomes

{1;1;0;0;0}+{0;0;0;0;0}

and returns

{1;1;0;0;0}

**Step 4 - Find first unique distinct row in range**

MATCH(0, NOT(DATE(YEAR($C$2), MONTH($C$2), 1)=DATE(YEAR($A$5:$A$9), MONTH($A$5:$A$9), 1))+COUNTIFS($A$22:$A22, $A$5:$A$9, $B$22:$B22, $B$5:$B$9, $C$22:$C22, $C$5:$C$9, $D$22:$D22, $D$5:$D$9), 0)

becomes

MATCH(0, {1;1;0;0;0}, 0)

and returns 3.

**Step 5 - Return a value of the cell at the intersection of a particular row and column**

INDEX($A$5:$D$9, MATCH(0, NOT(DATE(YEAR($C$2), MONTH($C$2), 1)=DATE(YEAR($A$5:$A$9), MONTH($A$5:$A$9), 1))+COUNTIFS($A$22:$A22, $A$5:$A$9, $B$22:$B22, $B$5:$B$9, $C$22:$C22, $C$5:$C$9, $D$22:$D22, $D$5:$D$9), 0), COLUMN(A1))

becomes

INDEX($A$5:$D$9, 3, COLUMN(A1))

becomes

INDEX({40290, " Jim Smith", 1, "Out of Service"; 40285, "John Doe", 3, "Requires Attention"; 40300, " Bob Smith", 3, "Requires Attention"; 40303, " Jim Smith", 1, "Out of Service"; 40300, " Bob Smith", 3, "Requires Attention"}, 3, 1)

and returns 2-MAy-2010

IFERROR converts errors to blank cells.

### Download excel *.xlsx file.

list-all-the-unique-events-for-a-specific-month.xlsx

**Functions in this article:**

**IF(**logical_test;[value_if:true];[value_if_false]**)
**Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

**INDEX(**array,row_num,[column_num]**)**

Returns a value or reference of the cell at the intersection of a particular row and column, in a given range

**SMALL(**array,k**)** Returns the k-th smallest row number in this data set.

**MATCH(**lookup_value;lookup_array; [match_type]

Returns the relative position of an item in an array that matches a specified value

**MIN(**number1,[number2]**)**

Returns the smallest number in a set of values. Ignores logical values and text

**ROW(**reference**)** returns the rownumber of a reference

**COLUMN(**reference**)
**returns the column number of a reference

**TEXT(**value, format_text**)**

Converts a value to text in a specific number format

Highlight overlapping date ranges using conditional formatting

How to highlight overlapping date ranges Click "Home" tab Click "Conditional Formatting" button Click "New Rule.." Click "Use a formula […]Count unique distinct values within same week, month or year

Introduction What are unique distinct values? Unique distinct values are all values but duplicates are merged into one value. Count […]Extract unique distinct values sorted based on sum of adjacent values

Table of Contents Filtering unique distinct text values and sort them based on sum of adjacent values Filtering unique distinct […]### 7 Responses to “List all unique events in a month”

### Leave a Reply

**How to add a formula to your comment:**

<code>your formula</code>

Remember to convert less than and larger than signs to html character entities before you post your comment.

**How to add VBA code to your comment:**

[vb 1="vbnet" language=","]

VBA code

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

Hi Oscar,

Thank you for this sample, it is really useful.

I am trying to use it for one control sheet that I have, however I have found a problem which I am not able to fix, I hope you can help me.

The problem happens if you have an event in the current month that had already occurred in a previous month. In that case that event will not appear in the list of unique events for the current month.

For instance, in the sample you have, assuming today’s date is 5-May-2010 and if you replace the name in the first event (cell B5) with Jim Smith (instead of John Doe), the list of unique events for May 2010 will show only the event of line 7 and not the one of line 8. The event of line 8 has occurred in April and not in May, but it is still filtered and not shown in the final result.

I hope you understand my explanation and also that you can find a solution.

Thank you in advance,

MV.

MV,

You are right!

I have changed this post.

Thanks for bringing this to my attention!

Hi Oscar,

Thanks a lot!

MV

Oscar,

I have a similar issue and would ask if you can help with the final step of extracting a list of names from a 'helper' column that fall within a date range?

I have a worksheet with 2 tabs, one for DATA (over 4,000 rows) and the other is used to do lookups and reflect calculations on the data (REPORT). I attach an image of a spreadsheet I created just to give you an idea of what the columns and ranges are: https://postimg.org/image/c203uwp5h/

On the DATA tab, there are 2 columns of data 'Dates' and 'Agent' (these are the range names as well) - and I've created a 3rd column using INDEX/MATCH that contains a unique list of agent names found in the 'AGENT' range (named range of AGENTLIST).

Now I need to use this 'helper' column to derive a 2nd list (on the REPORT Tab) of just those agent names that have records that fall within two dates (date fields also on the REPORT Tab). As I change the dates, I would expect the 2nd list of names to be updated as the sheet recalculates.

If I had my 'druthers', it would be GREAT if that list is sorted.

I do not have the excel experience to do this, and I derived the first 'unique' list only after much studying of all the similar posts on this site (great site BTW). I hope you can help me.

Thanks,

Rich

Rich Darlington

Use a pivot table!

https://www.get-digital-help.com/2016/07/04/excel-pivot-tables/

Hi,

Great site!

I need help comparing two ranges and extracting unique names on one side, and repeated names on the other.

For instance, in one range I have a list of all the employees currently working in my office. They are in a separate sheet named "operadores".

They don't have to come to work every day, so in a different sheet on my workbook, I have a grid that lists the days of the semester in column C (there's a blank row between each day), and somewhere in those two rows there's the name of the employees that are assigned to work that day, next to the assignment they are working on.

I would need a formula that looks what the names of my employees are, and checks whether they are assigned that day.

After that, I would split it in two:

- On one side I would need to know who is free to be assigned to a different project.

- On the other side, I would need to know who is assigned so I can call them and let them know they have to come to work.

Is that possible? I'm working on Excel 2013.

Thanks!

Alejandra

Alejandra

Can you describe in greater detail how data is arranged on your worksheets? Perhaps an example or a picture?