Use Vlookup to insert row above Data Sections

mrmmickle1

Well-known Member
Joined
May 11, 2012
Messages
2,461
I have two Spreadsheets with different Data on them. They have a Customer Code that I would like to use as a Header on SubSets of data. The data looks like this for Sheet1
Excel 2010
AB
1CodeCompany Name
2JLGPHAIR CANADA JAZZ-LG PBH
3RBLDLRBLDL
4HUNAIAIR CONTRACTORS-IRELAND
5MOUACMOUNTAIN AIR CARGO
6AIRWAAIR WISCONSIN AIRLINES
7PINNPINNACLE AIRLINES
OpenWorkOrders09 06 12


The Data Looks like this for OpenWorkOrders:

Excel 2010
ABCDEFGHIJKLMN
1CodeEntry DateWO NumberStatusCompany NameSitePart NumberDescriptionNSN #Serial NumberDepartmentWO DescriptionNH WO #Total Price
2MOUAC3/8/2012L022903ClosedMOUNTAIN AIR CARGOD61089_LG Non-PBHMPGL0220720
3MOUAC########LN30243-47Sub-AssemblyMOUNTAIN AIR CARGOA76527-7A76527-7SFT24LG Non-PBHLN302430
4MOUAC3/8/2012L033568ClosedMOUNTAIN AIR CARGOA76527-7A76527-7LG Non-PBHL0319250
5JLGPH3/8/2012L035465ClosedAIR CANADA JAZZ-LG PBH#NAME?#NAME?LG PBHL0332880
6JLGPH########LC40023-8ClosedAIR CANADA JAZZ-LG PBH16188-116188-1LG PBHLC400230
7JLGPH########LC40023-9ClosedAIR CANADA JAZZ-LG PBH16189-116189-1LG PBHLC400230
8JLGPH3/8/2012L033612ClosedAIR CANADA JAZZ-LG PBH16189-116189-1LG Non-PBHL0254150
9HUNAI6/4/2012LN30359-1Sub-AssemblyAIR CONTRACTORS-IRELANDD60980-1AXLE116U9LG Non-PBHLN303590
10HUNAI6/7/2012LN30359-27Sub-AssemblyAIR CONTRACTORS-IRELANDD61002BUSHING1LG Non-PBHLN303590
11HUNAI6/1/2012LN30362-4Sub-AssemblyAIR CONTRACTORS-IRELANDD57340BUSHING-THREADED5LG Non-PBHLN3036233557.92
Sheet1


I would like to Use the full length name of the Company based on the Company Code as a header above the other data. The data set is about 3,000 rows. An example of what I would like is this:

Excel 2010
ABCDEFGHIJKLMN
1CodeEntry DateWO NumberStatusCompany NameSitePart NumberDescriptionNSN #Serial NumberDepartmentWO DescriptionNH WO #Total Price
2MOUNTAIN AIR CARGO
3MOUAC3/8/2012L022903ClosedMOUNTAIN AIR CARGOD61089_LG Non-PBHMPGL0220720
4MOUAC########LN30243-47Sub-AssemblyMOUNTAIN AIR CARGOA76527-7A76527-7SFT24LG Non-PBHLN302430
5MOUAC3/8/2012L033568ClosedMOUNTAIN AIR CARGOA76527-7A76527-7LG Non-PBHL0319250
6AIR CANADA JAZZ-LG PBH
7JLGPH3/8/2012L035465ClosedAIR CANADA JAZZ-LG PBH#NAME?#NAME?LG PBHL0332880
8JLGPH########LC40023-8ClosedAIR CANADA JAZZ-LG PBH16188-116188-1LG PBHLC400230
9JLGPH########LC40023-9ClosedAIR CANADA JAZZ-LG PBH16189-116189-1LG PBHLC400230
10JLGPH3/8/2012L033612ClosedAIR CANADA JAZZ-LG PBH16189-116189-1LG Non-PBHL0254150
11AIR CONTRACTORS-IRELAND
12HUNAI6/4/2012LN30359-1Sub-AssemblyAIR CONTRACTORS-IRELANDD60980-1AXLE116U9LG Non-PBHLN303590
13HUNAI6/7/2012LN30359-27Sub-AssemblyAIR CONTRACTORS-IRELANDD61002BUSHING1LG Non-PBHLN303590
14HUNAI6/1/2012LN30362-4Sub-AssemblyAIR CONTRACTORS-IRELANDD57340BUSHING-THREADED5LG Non-PBHLN3036233557.92
Sheet1


The purpose of putting the data like this is so that I can group it by customer and collapse and uncollapse the data. Is there any easy way to count up from the bottom and then insert the value of column 2 in Sheet 1 based on a Vlookup? Additionally is there a simple way to run a macro to group the data in collapsable tabs based on a change in customer for example maybe look for a value in the b column. If the cell is blank then group all rows below it until another blank cell is found and then do the same thing?

I know this is a very detailed question. Any partial help or complete help would be much appreciated.

-Matt
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,214,913
Messages
6,122,207
Members
449,074
Latest member
cancansova

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