Range Placement

Gamermatt

Board Regular
Joined
May 14, 2009
Messages
186
Hello,

I need a macro or formula for this task. I need lines (products) to be sorted into year categories.

The product years can be found in column AA. The category years can be found in AC - AI.

The product years should be compared to the category years. It should look within each range and decide if the product years belong in the category years. As long as the category years contain at least 1 year that the products years contain, it should be placed in that category (examples below).

If there are no category years, nothing should be done.

If there are more than one category years that it belongs in, the whole row should be copied, and the next category years should reside below it.


Before:


Excel Workbook
AAABACADAEAFAGAHAI
22005-2009*1000-30001988-19911992-19951996-20002001-20032004-20052006-Up
32004-2007*1000-30002000-20022003-2008****
42000-2001*1000-30002000-20022003-2008****
52000-2008*1000-3000******
62003-2008*1000-30002000-20022003-2008****
72005-2009*1000-30001988-19911997-20032004-Up***
81990-1999********
Sheet1




After:


Excel Workbook
AAABACADAEAFAGAHAI
22005-2009*1000-3000******
32005-2009*2004-2005******
42005-2009*2006-Up******
52004-2007*1000-3000******
62004-2007*2003-2008******
72000-2001*1000-3000******
82000-2001*2000-2002******
92000-2008*1000-3000******
102003-2008*1000-3000******
112003-2008*2003-2008******
122005-2009*1000-3000******
132005-2009*2004-Up******
141990-1999********
Sheet1


Note: I can replace "-Up" with "-2011" in order to be consistent.


How would I go about doing this?

Thanks in advanced,

Matt
 
Last edited:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hmmm.. I think you may need to redo the spreadsheet to make it easier on yourself in the end.

Rather than putting 2000-2009 in 1 cell since that isn't a number, make the range as 3 cells.

AA would be 2000, AB would be the - AC is 2009 and then you turn off gridlines and border those 3 cells, it will look like a single cell but you will have much quicker and easier access to get to the years, then you also will know, the AA column is always the start year and the AC column always the end year. X is greater than AA1 or less than AC1, much easier I feel.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

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