Extracting certain data from a worksheet

Tennisguuy

Well-known Member
Joined
Oct 17, 2007
Messages
564
Office Version
  1. 2016
Platform
  1. Windows
I am trying to figure out the best way to only extract certain data from a download from our rating system. Below is an example of how the data is downloaded from the system

VEH 1 - 2000 INTERNATIONAL 4000 4900 STRAIGHT TRUCK {1HTSDAAN7YH256306}
City State Territory Stated Amount Cost New Class Code
Ewing NJ 106 44988 33489
Liability
Med Pay
No-Fault
UM/UIM
UM - BI-PD - CSL
Comp 2000
Collision 2000

I wanted to create a template where I copy the data from the worksheet that is downloaded form the system into sheet1 and on sheet2 use formulas to extract only the data I want. I need to extract the vehicle which is the above example will always be in row B. I used this formula on sheet2 in cells A2:A300 IF(LEN(Sheet1!B1)>35,Sheet1!B1,"") the length of the vehicle will vary but in will always be greater than 35 characters and no other data will be more than 35 characters and it's working but the problem in when I copy the formula down of course it leaves blank spaces because in the above example that is only one auto and I could have say 100 auto so it could. Once I extracted the vehicle I used filters to remove the spaces which is working but I was wondering if there is a formula I could use so that I don't have to use filters to remove the spaces.

If this is possible I would also like to exact the comp and collision deductible for each auto. The Comp and collision is in column E and the value of the deductible is in column K

In sheet 2 I have the following headings. Vehicle is in cell A1, comp is in cell B1 and collision is in cell C1. I have the formula above in cell A2A300 F(LEN(Sheet1!B1)>35,Sheet1!B1,"") which extracts the vehicle

Vehicle Comp Coll

Is there a formula I could put in sheet2 Cells A2:300 to extract the vehicles so I don't have to use filter to remove the space. I don't know if it's possible to have formulas to extract the comp and collision since they are located below each vehile in different columns but thought I would ask but that is gravy if it can be done.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi @Tennisguuy,

According to your text, the second line has more than 35 characters,
City State Territory Stated Amount Cost New Class Code

so you could increase the length to 55 and the result would be as follows:


Sheet1
<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:629.23px;" /><col style="width:534.18px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">VEH 1 - 2000 INTERNATIONAL 4000 4900 STRAIGHT TRUCK {1HTSDAAN7YH256306}</td><td >VEH 1 - 2000 INTERNATIONAL 4000 4900 STRAIGHT TRUCK {1HTSDAAN7YH256306}</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">City State Territory Stated Amount Cost New Class Code</td><td >VEH 1 - 3000 INTERNATIONAL 4000 4900 STRAIGHT TRUCK {123467899}</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Ewing NJ 106 44988 33489</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Liability</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Med Pay</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">No-Fault</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">UM/UIM</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >8</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">UM - BI-PD - CSL</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >9</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Comp 2001</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >10</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Collision 2002</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >11</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">VEH 1 - 3000 INTERNATIONAL 4000 4900 STRAIGHT TRUCK {123467899}</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >12</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">City State Territory Stated Amount Cost New Class Code</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >13</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Ewing NJ 106 44988 33489</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >14</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Liability</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >15</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Med Pay</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >16</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">No-Fault</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >17</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">UM/UIM</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >18</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">UM - BI-PD - CSL</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >19</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Comp 3001</td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >20</td><td style="color:#333333; font-family:Verdana; font-size:9pt; ">Collision 3002</td><td > </td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Array Formula</td></tr><tr><td >B1</td><td >{=IFERROR(INDEX($A$1:$A20, SMALL(IF(LEN($A$1:$A$20)>55, ROW()), ROW())),"")}</td></tr></table></td></tr></table>

Array formulas
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
In this case and for my example, you must select from cell B1 and up to cell B20 and press Shift + Control + Enter

Note: Do not try and enter the {} manually yourself.
-------------------------

If not the case.
Then we can use the formula array but this time we check the first 3 letters to see if it starts with "VEH":

{=IFERROR(INDEX($A$1:$A20, SMALL(IF(LEFT($A$1:$A$20,3)="VEH", ROW()), ROW())),"")}

<tbody>
</tbody>
 
Upvote 0
Dante thanks for you help. I used your formula and they worked similar to mine because it doesn't remove the spaces when you copy it down unless I didn't do something correctly
 
Upvote 0
Array formulas
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.

Perform the following steps:
- Copy the formula into cell B1.
- Drag the formula to cell B20.
- Select the range from B1 to B20.
- Press F2 to edit the formula
- Press the Shif + Control + Enter keys at the same time.

All formulas are equal and will remain with curly braces {}
 
Upvote 0
Yes I entered the formula as an array. In your example above the data is listed one cell after the other and in my spreadsheet the data for each vehicle is list in B1:K100 The data is usually listed with 7 rows between B thru K. I tried to show that in my example but when I submitted the post to pulls everything together.
 
Upvote 0
Copy my example.
Then copy the formula into B1.
Now follow the steps:

- Drag the formula to cell B20.
- Select the range from B1 to B20. This is very important!
- Press F2 to edit the formula
- Press the Shif + Control + Enter keys at the same time.

All formulas are equal and will remain with curly braces {}
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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