## How to identify two consecutive dates in a list

*Article updated on May 31, 2013*

**Question:** How to identify two consecutive dates in a list?

**Answer:**

**Array formula in cell B1:**

**How to enter an array formula**

- Select cell B1
- Copy above formula (Ctrl + c)
- Click in formula bar

- Paste formula (Ctrl + v)
- Press and hold CTRL + SHIFT
- Press Enter
- Release all keys

### Explaining array formula in cell B1

**Step 1 - Check if next consecutive date is in cell range**

IF((A1+1)=$A$1:$A$30,A1+1,"")

becomes

IF((39462+1)={39462; 39451; 39468; 39454; 39452; 39457; 39477; 39453; 39471; 39464; 39450; 39471; 39457; 39455; 39463; 39456; 39476; 39471; 39449; 39466; 39478; 39475; 39460; 39463; 39453; 39463; 39477; 39449; 39477; 39477},39462+1,"")

and returns

{""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; 39463; ""; ""; ""; ""; ""; ""; ""; ""; 39463; ""; 39463; ""; ""; ""; ""}

**Step 2 - Return the largest value**

LARGE(IF((A1+1)=$A$1:$A$30,A1+1,""),1)

becomes

LARGE(IF({""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; 39463; ""; ""; ""; ""; ""; ""; ""; ""; 39463; ""; 39463; ""; ""; ""; ""},1)

and returns 39463 (2008-01-16) in cell B1.

**Step 3 - Remove errors**

If the LARGE function returns an error the IFERROR function removes that error. That happens every time there isn´t a following consecutive date.

### Download excel *.xlsx file

identify-2-consecutive-dates-in-a-list-in-excelv3.xlsx

### Functions in this post

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

LARGE(*array*, *k*)**
**Returns the k-th largest value in a data set.

Compare values between two columns and filter values existing in only one column

There are text values in column A and column B. The question is how do you compare the values in […]### 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

## Share this article