You obviously have a mapping somewhere of Old depts to New depts, so lets start with that. Name a sheet WS3 and in Col A starting A2 (Title assumed in A1), put all the old depts. Now in Col B put the new corresponding dept number.
Now select the entire table, titles and all, and name it Depts using Insert / Name / Define
Now, on your Sheet of Old depts with sales data (call it WS1), you can now use a VLOOKUP formula to convert all the old dept names to new dept names:-
With your dept names in Col A and dept sales in Col B, insert a new column between them, and we will put a VLOOKUP formula in here to do the mapping:-
In cell B2 on WS1 (Again assuming titles in row 1), put the following:-
=VLOOKUP(A1,Depts,2,0) and then copy down (With cell B2 selected, simply double click the bottom right hand corner of the cell where you see the black cross, and it will autofill).
Now select all of Col B, do Edit / Copy, then Edit / Paste Special / Values. You can either delete Col A now, or leave it for reference purposes. I'm going to assume you leave it as is for the moment.
Now you have three ways of grouping this data, and you should really try all, as all will be good learning exercises:-
1) Use a Pivot table. Select B1:C10000 or whatever your last cell is, then do Data / Pivot Table and Pivot Chart report / Next / Next / Finish
Drag the field in the box that will appear that is marked Dept over to the very left hand side of the table where it says ROW, and then just drag the field that says Sales into the big area marked Data.
You can then play with it like that, or copy and paste special to another sheet and leave it as a flat table.
There is a really nice intro to these at the following link:-
2) You can use Advanced Filter to group your data:-
Select B1:B1000 or whatever, and do Data / Filter Advanced Filter, Check 'Copy To Another Location', Use the select option on the 'Copy To' and select say cell B1010, or any cell below your existing list. Check the 'Unique values only' box and hit OK.
This will put a list of your depts below your table of data, although you may well already have this data somewhere else that you can copy, but it is a good learning exercise on how to get a list of unique values.
Now simply use SUMIF to collate the sales data, eg, assuming your list of depts now runs from B1010 to B1020, in cell C1010 put the following formula and copy down to C1020:-
=SUMIF($B$1:$B$1000,B1010,$C$1:$C$1000)
Job Done.
3) Select the data B1:C1000, and then sort on Col B in ascending/descending order.
Now with the same area still selected, do Data / Subtotals, At each change in 'Depts', put subtotal against 'Sales'. Then when done, you can simply click on the 1,2,3 at the left to Contract/Expand the list to either detail or summary level.
If you have any problems then just post back.
Regards
Ken....................
----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------