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 Jun 29th, 2003, 03:48 PM   #1
mdennis624
 
Join Date: Feb 2002
Location: York, PA
Posts: 12
Default Need Help combining 2 separate tables

I import a report into Excel that contains data in 2 separate tables. The tables are located one Above the other when imported into Excel. The Top table contains line item numbers and other miscellaneous data. The Bottom table also conatins the same line item numbers along with other associated data. However, the Bottom table might also contain various sub-line item numbers that Do Not have corresponding rows on the Top table. We need to combine these 2 tables into one single long table or worksheet so that all of the Line items and Sub-Line item rows are grouped together on the top table. Thanks in advance for your help.
mdennis624 is offline   Reply With Quote
Old Jun 29th, 2003, 05:04 PM   #2
Barry Katcher
 
Barry Katcher's Avatar
 
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,016
Default Re: Need Help combining 2 separate tables

Do the sub-line item numbers start with the same numbers as the line item numbers they are related to? If so, just remove any blank rows and sort on that column.
__________________
Barry-

Photo Restoration/Enhancement

http://www.smiledogproductions.com
click below for detour

Barry Katcher is offline   Reply With Quote
Old Jun 29th, 2003, 05:46 PM   #3
Todd Bardoni
 
Todd Bardoni's Avatar
 
Join Date: Aug 2002
Location: Rochester, MI USA
Posts: 3,044
Default Re: Need Help combining 2 separate tables

If the sub-lines' line numbers are blank, then you can do the following to fill in that data:

1. Select the first cell of the column containing the line numbers in the second table with the sub-lines.
2. Select the cells from your current selection to your last record.
3. Go to Edit/Go to/Special/Blanks.
4. Click inside your Formula bar and type =TheCellAddressoftheFirstCellYouSelected.
5. Hit Ctrl+Enter.
6. Copy the formulas and Paste Special/Values.

Now you can do a clean sort.
__________________
Todd


"I'm a Data Anlyst(intermediate) and have no idea what it's all about."
Todd Bardoni is offline   Reply With Quote
Old Jun 29th, 2003, 06:08 PM   #4
mdennis624
 
Join Date: Feb 2002
Location: York, PA
Posts: 12
Default Re: Need Help combining 2 separate tables

The bottom table contatins the same Line number and sub line item columns as the top table. The top table only ever contains the main line item and the sub line item number is always 00. The bottom table ontains additional rows containing the sub line numbers. None of the cells in either table are blnk.

Example:
Top Table:
Cell A Cell B
001 00
002 00
003 00
004 00

Bottom Table:
Cell A Cell B
001 00
001 01
001 02
001 03
002 00
002 01
003 00
003 01
004 00

The sub line item data in table 2 is unique to corresponding top table line item so they must stay on separate rows. I need to move them to the top table and append them to the end. However I need to first insert the correct number of rows under each line item on the top table. Not all line items will have sub line items and the quantites os sub line iytes can vary. I was thinking of somehow scanning the bottom table for line items with matchng sub line items and then inserting the correct number of necessary rows beneath each corresponding line item on the top table. Then simply move the bottom table to to end fo the top table and continue my work from there. I can't figure out how to do the scanning and inserting the additional rows at the right places on the top table. I saw one tip that recommended using UNION but I can't find any info on that usage. Also I am using Excel 97. Thanks again.
mdennis624 is offline   Reply With Quote
Old Jun 30th, 2003, 04:00 AM   #5
Barry Katcher
 
Barry Katcher's Avatar
 
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,016
Default Re: Need Help combining 2 separate tables

I may be exhibiting my usual denseness in missing something, but from reading and re-reading your question, it appears that what you are asking for is what appears in the sample below:

******** ******************** ************************************************************************>
Microsoft Excel - Book1___Running: xl2000 : OS = Windows 98
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout
=

A
B
C
D
E
1
Before**After*
2
Top**Acct.Sub
3
00100*00100
4
00200*00100
5
00300*00101
6
00400*00102
7
***00103
8
Bottom**00200
9
00100*00200
10
00101*00201
11
00102*00300
12
00103*00300
13
00200*00301
14
00201*00400
15
00300*00400
16
00301***
17
00400***
Sheet1*

[HtmlMaker 2.32] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.


It that's the case, just delete the rows between the bottom of the first table and the top of the second, and sort by 1) the first column, ascending and then by 2) the second column ascending.

Again, if my pea brain is missing something, please accept my appy polly loggies.
__________________
Barry-

Photo Restoration/Enhancement

http://www.smiledogproductions.com
click below for detour

Barry Katcher is offline   Reply With Quote
Old Jul 1st, 2003, 01:50 AM   #6
mdennis624
 
Join Date: Feb 2002
Location: York, PA
Posts: 12
Default Re: Need Help combining 2 separate tables

Hi Barry,
I can tell by the feedback that I didn't do a very good job explaining my request. The bottom table contains unique data columns that do not appear on the top table, except for the line item numbers themselves which is what is common between the 2 tables. We need to get all of the data from the bottm table appended to the end of the top table. The probelm is the bottom table can have additional sub line items that must be accounted for on the top table. If I just move the bottom table to the end of the top table, when ever a subline item occurs, that appended row of data will not be associated with the correct line item anymore. I hope this helps. Thanks for your help and patience.
mdennis624 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 +1. The time now is 01:14 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 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