MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 16th, 2002, 12:01 PM   #1
radar2000
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

Hi everyone.

I have a bit of a problem that I need your help with.

I have an excel spreadsheet which needs to be altered...Please see sample below:

Dealer ID# Rep ID# Name
12345 abc1 jake
12345 abc2 joe
12345 abc3 phil
56789 def1 bob
56789 def2 bill

I need to transfrom the above to show the following Dearler ID# in one row...for example:

Dealer ID# Rep ID# Name Rep ID# Name
12345 abc1 jake abc2 joe
56789 def1 bob def2 bill

Please note that there may be more than 25 Rep ID#'s under one dealership. I need to have this Rep info shown across one row per each Dealership ID#.

Anyones help would greatly be appreciated.

Thank you.





_________________
Radar2000

[ This Message was edited by: radar2000 on 2002-04-16 11:02 ]

[ This Message was edited by: radar2000 on 2002-04-16 11:03 ]
radar2000 is offline   Reply With Quote
Old Apr 17th, 2002, 06:48 AM   #2
cpod
Board Regular
 
Join Date: Apr 2002
Posts: 124
Default

If your data starts in A2,B2,C3 then, starting in E2, put a unique list (you can get a unique is by using Advanced Filter - Data/Filter/AdvancedFilter) of the data in column A.

Then in F2:

=IF($E2=INDEX($A$2:$C$500,MATCH($E2,$A$2:$A$500,FALSE)+COLUMN()-6,1),OFFSET($A$1,MATCH($E2,$A$2:$A$500,FALSE)+COLUMN()-6,1) & " " & OFFSET($A$1,MATCH($E2,$A$2:$A$500,FALSE)+COLUMN()-6,2),"")

and copy across and down.

cpod is offline   Reply With Quote
Old Apr 17th, 2002, 07:45 AM   #3
radar2000
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

Hi cpod.

Thanks for your quick reply !

My data does start in A2,B2,C2. Please note that in in cells A1,B1,C1 contain header info.

I tried the advanced filter option, but I don't think I'm doing this right.

As per your instructions I put the cell in E2 and proceeded to apply the advanced filter. My questions here, are as follows:

1) in the list range section of this filter, what should I select? Should I select columns A & E?

2) Do I need to put anything in the criteria range?

3) Should I check-off the unique records only box?


Thank you.
radar2000 is offline   Reply With Quote
Old Apr 17th, 2002, 08:35 AM   #4
cpod
Board Regular
 
Join Date: Apr 2002
Posts: 124
Default

For the list range select only the data in column A including cell A1.

Put a check in the "Unique Records" check box.

Select "Copy to Another Location" and in the "Copy To" box select a range starting at E1 and big enough to hold the unique list such as E1:E500.

Leave the criteria range blank.
cpod is offline   Reply With Quote
Old Apr 17th, 2002, 08:55 AM   #5
radar2000
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

Hi cpod.

Looks like the advanced filter worked. It basically created a second column A for me under column E. It also took away any duplicate ID#'s that were found under column A.

Now I pasted your formula in cell F2 and received a #Value! message.

Am I doing something wrong?

Thank you.


__________________
Radar2000
radar2000 is offline   Reply With Quote
Old Apr 17th, 2002, 09:28 AM   #6
cpod
Board Regular
 
Join Date: Apr 2002
Posts: 124
Default

Is your data structured as in the example in your original post?

Does E2 contain the first value in your Dealer ID# list in column A?
cpod is offline   Reply With Quote
Old Apr 17th, 2002, 11:55 AM   #7
radar2000
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

Hi cpod.

Yes it is.

Column A contains Dealer ID#'s
Column B contains Code ID#'s
Column C contains Name

After doing the advanced filter option, my column E now contains the Dealer ID# info.

Thank you.


__________________
Radar2000
radar2000 is offline   Reply With Quote
Old Apr 17th, 2002, 06:44 PM   #8
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,319
Default

Column A contains Dealer ID#'s
Column B contains Code ID#'s
Column C contains Name

After doing the advanced filter option, my column E now contains the Dealer ID# info.


Also, given the sample in A1:C6 including labels and the unique list in E,

in D1 enter:

=MATCH(9.99999999999999E+307,A:A)-ROW(1:1)

In F2 enter and copy across to G2:

=IF(LEN($E2),VLOOKUP(E2,OFFSET(A$2,0,0,$D$1,2),2,0),"")

in H2 enter:

=IF(AND(LEN($E2),COUNTIF(OFFSET($A$2,0,0,$D$1,1),$E2)>COUNTA($F2:G2)/2),INDEX(OFFSET($B$2,MATCH(F2,OFFSET($B$2,0,0,$D$1,1),0),0,$D$1,1),MATCH($E2,OFFSET($A$2,MATCH(F2,OFFSET($B$2,0,0,$D$1,1 ),0),0,$D$1,1),0)),"")

in I2 enter:

=IF(LEN(H2),VLOOKUP(H2,OFFSET($B$2,0,0,$D$1,2),2,0),"")

Select H2:I2 and copy across as far as needed, say, till column M.

Now select F2:M2 and copy down as far as needed.

The above schema does not require that the data be sorted. It can also dynamically cope with addtitions/deletions that may occur in the data range.

Just curious: Why do you want this rearrangemnet of data?

Aladin

Aladin Akyurek is offline   Reply With Quote
Old Apr 17th, 2002, 08:26 PM   #9
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Hi radar2000:
I think your project is also a good candidate for a pivot table solution -- you ought to try it to get different layouts and statistics.
__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Apr 18th, 2002, 07:27 AM   #10
radar2000
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

Hi Aladin.

THANK YOU!!!

This seemed to do the trick!

To answer your question, I needed this data to be spread accross the spreadsheet, so that I can send out an email merge to dealership owners.

By doing this, I will only need to send one email per dealer which contains their rep information. If I had done it the otherway, I would be sending multiple emails to the same dealership owner for each rep information.

I do various email merges by using Word and Excel.

Yogi, I had tried using the pivot option, but there were too many variables to work with.

Aladin, I've I needed to insert another 2 columns, how would I need to change your formula? For example, I needed to include additional data for the reps in columns D & E.

I would like to thank everyone for their help and knowledge with this problem !




__________________
Radar2000
radar2000 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:41 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes