Data Prospector
Data Prospector

Reputation: 27

How to create a list of years between two columns dates in Excel?

I have the following layout in a data set:

enter image description here

I would like to have a formula which would print a list of the years from the start year to the end year in column B?

Any ideas on a formula that would achieve this ?

Thanks

Upvotes: 0

Views: 339

Answers (2)

Rajput
Rajput

Reputation: 605

Try this: Excel 365

=TEXTJOIN(", ",TRUE,SEQUENCE(1,C2-A2+1,A2))

working for me.

enter image description here

Upvotes: 1

MGP
MGP

Reputation: 2551

You will need Office 365 for this, but then you could use:

=TEXTJOIN(",",TRUE,A2+SEQUENCE(A2-C2-1))

After seeing your comment, you would have to use:

=TEXTJOIN(",",TRUE,A2+SEQUENCE(A2-C2+1)-1)

Upvotes: 1

Related Questions