# Excel, is there a simpler way to do this?

**URL:** https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197
**Category:** Factual Questions
**Created:** [March 8, 2012, 9:09pm UTC](https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197 "2012-03-08T21:09:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@Nobody](https://boards.straightdope.com/u/Nobody)
#### Post date: [March 8, 2012, 9:09pm UTC](https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197/1 "2012-03-08T21:09:12Z")

</div>

I have a couple of charts that are dated. For a while…well, long story short I had to try quite a few formulas to get one that, at the end of the year would roll over to the next one.

Basically I set it up so one cell has a date, and then following cells increase one day at a time. But if I tired something simple like Day(cell)+1 for example, it would work, up until December 31. Then the year would roll over to 00.

I came up with this just now. It’s no big deal, but I am curious if there’s a simpler way to do this. Thanks.

=IF(AND(MONTH(B2)=12, DAY(B2)=31), DATE(YEAR(B2)+1, 1, 1), DATE(YEAR(B2), MONTH(B2), DAY(B2)+1))

---

<div class="post-metadata">

### Author: ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)
#### Post date: [March 8, 2012, 9:23pm UTC](https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197/2 "2012-03-08T21:23:08Z")

</div>

If you have a date in a cell then the next day is found with

=B2+1

You don’t need to add a bunch of logic for month/year rollover, it’s already built in.

ETA: I am confused about what you could possibly be doing that causes the year to go to 00 when you add one day.

---

<div class="post-metadata">

### Author: ![DCnDC](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dcndc/32/2842_2.png) [@DCnDC](https://boards.straightdope.com/u/DCnDC)
#### Post date: [March 8, 2012, 9:34pm UTC](https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197/3 "2012-03-08T21:34:00Z")

</div>

I don’t understand. Why can’t you just corner-pull down (or over) from the first dated cell? It should automatically populate all of the cells with consecutive days.

---

<div class="post-metadata">

### Author: ![Nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@Nobody](https://boards.straightdope.com/u/Nobody)
#### Post date: [March 9, 2012, 1:14am UTC](https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197/4 "2012-03-09T01:14:34Z")

</div>

> [@CookingWithGas](#):
>
> If you have a date in a cell then the next day is found with
> 
> =B2+1
> 
> You don’t need to add a bunch of logic for month/year rollover, it’s already built in.
> 
> ETA: I am confused about what you could possibly be doing that causes the year to go to 00 when you add one day.

OK, this is strange. I know I tried it before and it didn’t work, but I just tried it again and it did. 😕

> [@DCnDC](#):
>
> I don’t understand. Why can’t you just corner-pull down (or over) from the first dated cell? It should automatically populate all of the cells with consecutive days.

The chart I’m using has eight columns with dates in every other column. In each of those columns there’s a date, three blank rows, another date, and so on. So I’d have to put a date in four columns and pull down, and I just want to put a date in one column.

Anyway, like I said, the method CookingWithGas gave worked for some reason even though it didn’t work before. Guess I’ll chalk it up to a glitch.

---

<div class="post-metadata">

### Author: ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)
#### Post date: [March 9, 2012, 1:30am UTC](https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197/5 "2012-03-09T01:30:40Z")

</div>

You may have had something quirky in the formatting, I’m not sure. I can tell you that every time I think I have found a bug in Excel it turns out to be user error 🙂

---

<div class="post-metadata">

### Author: ![Nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@Nobody](https://boards.straightdope.com/u/Nobody)
#### Post date: [March 9, 2012, 1:34am UTC](https://boards.straightdope.com/t/excel-is-there-a-simpler-way-to-do-this/615197/6 "2012-03-09T01:34:01Z")

</div>

😃 It could be PEBCAK, but I’m certain it’s not.
