what is best way to do this?

petethecat

Board Regular
Joined
Oct 25, 2011
Messages
63
I want to interrogate some data that is only available in a certain format & can change every day. The objective is to extract the data under the "header" so that ultimately i can use a VLOOKUP to get what i want from the data.

This is how it looks at present:
[TABLE="width: 600"]
<colgroup><col span="5"><col><col span="3"></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]Leg 4[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2001A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2500[/TD]
[TD]SF632V(1)[/TD]
[TD]MB[/TD]
[TD="align: right"]7604[/TD]
[TD="align: right"]1013904[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2002A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2500[/TD]
[TD]SF632V(1)[/TD]
[TD]MB[/TD]
[TD="align: right"]7604[/TD]
[TD="align: right"]1013901[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2003A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1200[/TD]
[TD]SF632V(1)[/TD]
[TD]MB[/TD]
[TD="align: right"]7604[/TD]
[TD="align: right"]1013905[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2004A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2500[/TD]
[TD]SF632V(1)[/TD]
[TD]MB[/TD]
[TD="align: right"]7604[/TD]
[TD="align: right"]1013630[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2006A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1200[/TD]
[TD]SF632V(2)[/TD]
[TD]MB[/TD]
[TD="align: right"]7604[/TD]
[TD="align: right"]1013902[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2007A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1200[/TD]
[TD]SF632V(2)[/TD]
[TD]MB[/TD]
[TD="align: right"]7604[/TD]
[TD="align: right"]1013629[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2008A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3600[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2044[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]SF632V(2)[/TD]
[TD]MB[/TD]
[TD="align: right"]7604[/TD]
[TD="align: right"]1013625[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]Leg 5[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T2002B[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]DF770E(1)[/TD]
[TD]VS[/TD]
[TD="align: right"]6233[/TD]
[TD="align: right"]1013809[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T202[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]DF770E(2)[/TD]
[TD]VS[/TD]
[TD="align: right"]6233[/TD]
[TD="align: right"]1013810[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]A300[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]DF578E(1)[/TD]
[TD]JL[/TD]
[TD="align: right"]5976[/TD]
[TD="align: right"]1013805[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]DF578E(2)[/TD]
[TD]JL[/TD]
[TD="align: right"]5976[/TD]
[TD="align: right"]1013806[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]DF770E(1)[/TD]
[TD]VS[/TD]
[TD="align: right"]6233[/TD]
[TD="align: right"]1014077[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]DF770E(2)[/TD]
[TD]VS[/TD]
[TD="align: right"]6233[/TD]
[TD="align: right"]1014078[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]Leg 7[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T880[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]SF630VCM(1)[/TD]
[TD]VW[/TD]
[TD="align: right"]6380[/TD]
[TD="align: right"]1013819[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T881[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]SF630VCM(1)[/TD]
[TD]VW[/TD]
[TD="align: right"]6381[/TD]
[TD="align: right"]1013817[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T882[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T883[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]SF630VCM(2)[/TD]
[TD]VW[/TD]
[TD="align: right"]6381[/TD]
[TD="align: right"]1013818[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T884[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]SF630VCM(2)[/TD]
[TD]VW[/TD]
[TD="align: right"]6380[/TD]
[TD="align: right"]1013820[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T885[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]SF630VCM(2)[/TD]
[TD]VW[/TD]
[TD="align: right"]6381[/TD]
[TD="align: right"]1013816[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]T886[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD]DW2114LB(1)[/TD]
[TD]LB[/TD]
[TD="align: right"]6133[/TD]
[TD="align: right"]1014105[/TD]
[/TR]
</tbody>[/TABLE]

What i want to do is have a new column that identifies the area (LEG4, LEG5 LEG7 In bold/italics) and what ever is under that is called the heading. IE in a column next to T2001 I would want to have "LEG 4" shown. Same in T2002 Etc until we get to LEG5 where i would want to show LEG5 against T2002B & so on all the way down.

I have attempted If/AND but i come unstuck when we get further down the list as the statement does not cover all the scenarios.

This must be a simple thing to rectify but i cant for the life in me think what it is!

Any help is greatly appreciated.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Does this work for what you need?



Book1
ABCDEFG
1Leg 4Leg 4
2T2001ALeg 42500SF632V(1)MB76041013904
3T2002ALeg 42500SF632V(1)MB76041013901
4T2003ALeg 41200SF632V(1)MB76041013905
5T2004ALeg 42500SF632V(1)MB76041013630
6T2006ALeg 41200SF632V(2)MB76041013902
7T2007ALeg 41200SF632V(2)MB76041013629
8T2008ALeg 43600
9Leg 4
10T2044Leg 4SF632V(2)MB76041013625
11Leg 5Leg 5
12Leg 5
13T2002BLeg 5DF770E(1)VS62331013809
14T202Leg 5DF770E(2)VS62331013810
15A300Leg 5DF578E(1)JL59761013805
16Leg 5DF578E(2)JL59761013806
17Leg 5DF770E(1)VS62331014077
18Leg 5DF770E(2)VS62331014078
19Leg 7Leg 7
20T880Leg 7SF630VCM(1)VW63801013819
21T881Leg 7SF630VCM(1)VW63811013817
22T882Leg 7
23T883Leg 7SF630VCM(2)VW63811013818
24T884Leg 7SF630VCM(2)VW63801013820
25T885Leg 7SF630VCM(2)VW63811013816
26T886Leg 7DW2114LB(1)LB61331014105
Sheet1
Cell Formulas
RangeFormula
B1=IF(ISNUMBER(SEARCH("Leg",D1)),D1,OFFSET(D1,-1,-2))
 
Last edited:
Upvote 0
one question though. What would i need to change if i wanted to shift the column across to the left (2 columns - so a new column A) Where the data is shown in the example i cant use that column - Col B. I would need to insert a column, move everything over by one & use a new column A
 
Upvote 0
Assuming that you insert a new column as A and your heading column now becomes Column E - Enter into Cell A1;


=IF(ISNUMBER(SEARCH("Leg",E1)),E1,OFFSET(E1,-1,-4))
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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