extract text and consolidate

Birdy01962

New Member
Joined
Jun 27, 2016
Messages
25
I have a list

(A1) is Job Description,
(A2) Cost items (Materials and Labour)
(A3) Qty (Items and Hours)

from this list I would like to extract all labour hours together with each Job Description into another work sheet. So far I have identified all "Lab" lines but where do I go to extract and consolidate into new sheet.

Job DescriptionMaterialQuantityidentify "Lab"
Site PreparationSkip Hire2NO
Site PreparationDigger/Day2NO
Site PreparationLABOUR - Day Rate Paul2OK
Site PreparationLABOUR - Day Rate Staff2OK
FootingsCement6NO
FootingsBallast / tonne3NO
FootingsLABOUR - Day Rate Paul2OK
WallBrickwork / 1003NO
WallLABOUR - Day Rate Paul3OK
CleaningLABOUR - Day Rate Paul4OK
What I require
No of Hours
Site PreparationLABOUR - Day Rate Paul (plus Labour - Day Rate Staff)4
FootingsLABOUR - Day Rate Paul2
WallLABOUR - Day Rate Paul3
CleaningLABOUR - Day Rate Paul4

<tbody>
</tbody>


:confused:
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try this for Results on sheet2.
Code:
[COLOR="Navy"]Sub[/COLOR] MG22Nov50
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Q [COLOR="Navy"]As[/COLOR] Variant, Ray [COLOR="Navy"]As[/COLOR] Variant
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Left(Dn.Offset(, 1).Value, 6) = "LABOUR" And Dn.Value <> "" [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]If[/COLOR] Not .Exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
            .Add Dn.Value, Array(Dn.Value, Dn.Offset(, 1).Value, Dn.Offset(, 2).Value)
        [COLOR="Navy"]Else[/COLOR]
            Q = .Item(Dn.Value)
            [COLOR="Navy"]If[/COLOR] InStr(Q(1), Dn.Offset(, 1).Value) = 0 [COLOR="Navy"]Then[/COLOR]
                Q(1) = Q(1) & " + " & Dn.Offset(, 1).Value
            [COLOR="Navy"]End[/COLOR] If
            Q(2) = Q(2) + Dn.Offset(, 2).Value
            .Item(Dn.Value) = Q
        [COLOR="Navy"]End[/COLOR] If
   [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
Ray = .items: n = .Count
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]With[/COLOR] Sheets("Sheet2").Range("A1")
        .Resize(, 3).Value = Array("Job", "Labour", "Qty")
        .Offset(1).Resize(n, 3).Value = Application.Transpose(Application.Transpose(Ray))
        .Resize(n + 1, 3).Columns.AutoFit
        .Resize(n + 1, 3).Borders.Weight = 2
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Thanks Mick for your help and suggestion above however when I run it produces a "run time error 13 Type mismatch" after "sheet2"....Offset(1).Resize).....

After the error "Sheet2" has the headings "Job","Labour"and "Qty" only - no Labour line items.

Can you suggest where its going wrong.

Regards Birdy01962
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,884
Members
449,477
Latest member
panjongshing

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