How to make a list?

jints92

New Member
Joined
Aug 27, 2012
Messages
11
If I have a list of years (some occurring many times) how do I make a list in the next column to add any years that don't appear. For example:

My list looks like this:
[TABLE="width: 408"]
<colgroup><col span="8" width="51"></colgroup><tbody>[TR]
[TD="class: xl141, width: 51, align: right"]2000[/TD]
[TD="class: xl141, width: 51, align: right"]2001[/TD]
[TD="class: xl141, width: 51, align: right"]2001[/TD]
[TD="class: xl141, width: 51, align: right"]2002[/TD]
[TD="class: xl141, width: 51, align: right"]2004[/TD]
[TD="class: xl141, width: 51, align: right"]2004[/TD]
[TD="class: xl141, width: 51, align: right"]2004[/TD]
[TD="class: xl141, width: 51, align: right"]2006[/TD]
[/TR]
</tbody>[/TABLE]

I want it to look like this:
[TABLE="width: 510"]
<colgroup><col span="10" width="51"></colgroup><tbody>[TR]
[TD="class: xl141, width: 51, align: right"]2000[/TD]
[TD="class: xl141, width: 51, align: right"]2001[/TD]
[TD="class: xl141, width: 51, align: right"]2001[/TD]
[TD="class: xl141, width: 51, align: right"]2002[/TD]
[TD="class: xl141, width: 51, align: right"]2003
[/TD]
[TD="class: xl141, width: 51, align: right"]2004[/TD]
[TD="class: xl141, width: 51, align: right"]2004[/TD]
[TD="class: xl141, width: 51, align: right"]2004[/TD]
[TD="class: xl141, width: 51, align: right"]2005
[/TD]
[TD="class: xl141, width: 51, align: right"]2006
[/TD]
[/TR]
</tbody>[/TABLE]

If anyone can help please?
 
You are welcome and thanks for the feedback

The key-part of the formula is
IF(COUNTIF($A$2:$H$2,A3)>COUNTIF($A$3:A3,A3),A3,A3+1)

The first part
IF(COUNTIF($A$3:A3,MAX($A$2:$H$2))=COUNTIF($A$2:$H$2,MAX($A$2:$H$2)),"",...
only serves to prevent the formula returns numbers greater than MAX


M.
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Maybe...another possible solution

Assuming your data in A2:H2
[TABLE="width: 576"]
<tbody>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]1999[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]2001[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]2001[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]2002[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]2004[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]2004[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]2006[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]2006[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"][/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"][/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"][/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]1999[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2000[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2001[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2001[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2002[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2003[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2004[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2004[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2005[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2006[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]2006[/TD]
[TD="class: xl65, bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]


Type in A3 the first value of the serie (1999 in the example above)

Formula in B3
=IF(COUNTIF($A$3:A3,MAX($A$2:$H$2))=COUNTIF($A$2:$H$2,MAX($A$2:$H$2)),"",IF(COUNTIF($A$2:$H$2,A3)>COUNTIF($A$3:A3,A3),A3,A3+1))

copy across till you get a blank cell

M.

This worked too. Thanks for the help.
 
Upvote 0
This worked too. Thanks for the help.

Sorry, it looks like I "stole" your thanks to T. Valko

I thought you were in # 10 was referring to my suggestion.
(T. Valko solutions always work!)

So, you have two solutions that work with formulas and another using a macro.

Enjoy!

M.
 
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top