Find value in one column and return value from same row but different column in another tab

Vickie Hartley

New Member
Joined
Aug 19, 2015
Messages
13
I work for a non-profit community housing agency and created a workbook that has multiple tabs. One of the tabs is a spreadsheet that contains 22 columns (scope assumptions). On another tab I want to pull data from this large spreadsheet. There are usually at least a 100 rows, each room in a house has multiple lines and tasks with sub-totals by room. The spreadsheets primary purpose is to communicate to the construction crew what needs to be done in each room and what the budget is. Here is an example of the primary spreadsheet.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Location[/TD]
[TD]Task[/TD]
[TD]Description[/TD]
[TD]Labor Hours[/TD]
[TD]Labor Costs[/TD]
[TD]Materials[/TD]
[TD]Subs[/TD]
[TD]OH,G&A, Profit[/TD]
[TD]Contract Amount[/TD]
[/TR]
[TR]
[TD]Front Porch[/TD]
[TD]Demolition[/TD]
[TD]Demo garbage, existing windows, steps[/TD]
[TD]3[/TD]
[TD]90[/TD]
[TD]50[/TD]
[TD][/TD]
[TD]60[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]Front Porch[/TD]
[TD]Electrical[/TD]
[TD]Properly install wire mold at outlet close to ceiling and exterior light[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]165[/TD]
[TD]71[/TD]
[TD]236[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD][/TD]
[TD]90[/TD]
[TD]50[/TD]
[TD]165[/TD]
[TD]131[/TD]
[TD]436[/TD]
[/TR]
[TR]
[TD]Living Room[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new light switch and cover plate[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50[/TD]
[TD]21[/TD]
[TD]71[/TD]
[/TR]
[TR]
[TD]Living Room[/TD]
[TD]Doors & Windows[/TD]
[TD]Furnish and install new trim and windows (3)[/TD]
[TD]8[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD][/TD]
[TD]257[/TD]
[TD]857[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]8[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]50[/TD]
[TD]278[/TD]
[TD]928[/TD]
[/TR]
[TR]
[TD]*******[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new 240V outlet for range and 120V outlet for fridge[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]500[/TD]
[TD]214[/TD]
[TD]714[/TD]
[/TR]
[TR]
[TD]*******[/TD]
[TD]Plumbing[/TD]
[TD]******* sink - Furnish and install new PVC drain, vent and pex supply lines with shut off valves and all sundries for complete install[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1050[/TD]
[TD]450[/TD]
[TD]1500[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1550[/TD]
[TD]664[/TD]
[TD]2214[/TD]
[/TR]
</tbody>[/TABLE]

A second, third and fourth spreadsheet is needed to communicate to the sub-contractors what needs to be done. One spreadsheet each for Electrical, Plumbing, and HVAC. Ideally I want to create formulas that will look for every occurrence of a given task (i.e. "Electrical") in column B from the primary spreadsheet and return the corresponding location, description, and cost for each occurrence. For example:

Electrical Scope
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Location[/TD]
[TD]Description[/TD]
[TD]Budget[/TD]
[/TR]
[TR]
[TD]Front Porch[/TD]
[TD]Properly install wire mold at outlet close to ceiling and exterior light[/TD]
[TD]236[/TD]
[/TR]
[TR]
[TD]Living Room[/TD]
[TD]Furnish and install new light switch and cover plate[/TD]
[TD]71
[/TD]
[/TR]
[TR]
[TD]*******[/TD]
[TD]Furnish and install new 240V outlet for range and 120V outlet for fridge[/TD]
[TD]714[/TD]
[/TR]
</tbody>[/TABLE]


Can you please give me some guidance and/or answers?

I often use Mr. Excel to solve my Excel problems by looking for similar problems or using the books I have purchased but this time, I could not find a solution so I posted my first request for help. I have been using this site for about 3 years.

I have tried a multitude of nested formulas (search, if, lookup, index, etc) to get this to work.
 
Let's try this...

In the line:

ThisWorkbook.Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(1, LastCol)).AutoFilter

Replace "LastCol" with the number of columns in the "Original scope assumptions" worksheet. So if the last column is letter I (as in Idea), then the number would be 9.
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Same error code - on same line. The line now reads:
ThisWorkbook.Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(1, 9)).AutoFilter

Here is the rest of the code:
For i = 1 To 3
If i = 1 Then Subcontractor = "Electrical"
If i = 2 Then Subcontractor = "Plumbing"
If i = 3 Then Subcontractor = "HVAC"

Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(LastRow, LastCol)).AutoFilter Field:=2, Criteria1:=Subcontractor
Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(LastRow, LastCol)).Copy
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = Subcontractor
ActiveSheet.Paste
For j = LastCol To 1 Step -1
If Cells(1, j).Value <> "Location" And Cells(1, j).Value <> "Description" And Cells(1, j).Value <> "Contract Amount" And Cells(1, j).Value <> "Budget" Then Cells(1, j).EntireColumn.Delete
If Cells(1, j).Value = "Contract Amount" Then Cells(1, j).Value = "Budget"
Next j
Cells.Columns.AutoFit

Sheets("Original scope assumptions").Activate
Application.CutCopyMode = False
Next i


ThisWorkbook.Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(1, LastCol)).AutoFilter


Application.DisplayAlerts = True
Application.ScreenUpdating = True


End Sub


You have been so patient and helpful.
 
Upvote 0
Patient? Maybe... but so far not so helpful.

When you state "Here is the rest of the code:" - it was just an oversight when you didn't include the start of the code right? I mean, just above the offending line should be:

Code:
Sheets("Original scope assumptions").Activate
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
[COLOR=#808080]ThisWorkbook.Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(1, LastCol)).AutoFilter[/COLOR]

And in particular, there should be the line: Sheets("Original scope assumptions").Activate. Not having this line will produce a Run-time error '1004':

I think we've eliminated the LastCol as the error source; you can switch back to the original line:
ThisWorkbook.Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(1, LastCol)).AutoFilter
 
Upvote 0
Right, I did not include the whole code - just the portion after the offending line. Here is the whole code:

Sub CreateSubcontractorSheets()


Dim LastCol As Long
Dim LastRow As Long
Dim Subcontractor As String
Dim i As Long
Dim j As Long
Dim ws As Worksheet


Application.DisplayAlerts = False
Application.ScreenUpdating = False


For Each ws In ThisWorkbook.Worksheets
If ws.Name = "Electrical" Or ws.Name = "Plumbing" Or ws.Name = "HVAC" Then ws.Delete
Next


Sheets("Original scope assumptions").Activate
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
ThisWorkbook.Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(1, LastCol)).AutoFilter


For i = 1 To 3
If i = 1 Then Subcontractor = "Electrical"
If i = 2 Then Subcontractor = "Plumbing"
If i = 3 Then Subcontractor = "HVAC"

Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(LastRow, LastCol)).AutoFilter Field:=2, Criteria1:=Subcontractor
Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(LastRow, LastCol)).Copy
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = Subcontractor
ActiveSheet.Paste
For j = LastCol To 1 Step -1
If Cells(1, j).Value <> "Location" And Cells(1, j).Value <> "Description" And Cells(1, j).Value <> "Contract Amount" And Cells(1, j).Value <> "Budget" Then Cells(1, j).EntireColumn.Delete
If Cells(1, j).Value = "Contract Amount" Then Cells(1, j).Value = "Budget"
Next j
Cells.Columns.AutoFit

Sheets("Original scope assumptions").Activate
Application.CutCopyMode = False
Next i


ThisWorkbook.Sheets("Original scope assumptions").Range(Cells(1, 1), Cells(1, LastCol)).AutoFilter


Application.DisplayAlerts = True
Application.ScreenUpdating = True


End Sub
 
Upvote 0
Okay, here's the next thing we'll try...

Replace this line: Sheets("Original scope assumptions").Activate

with

ThisWorkbook.Sheets("Original scope assumptions").Activate
 
Upvote 0
Maybe this can help.

I'm not exactly sure about your layout. So you have one workbook with tabs. Something like this?



Let's suppose below is your Table on the sheet named Primary. (I put some additional data in it for better recognition).
Make sure that the names you use are consistent. Otherwise you get problems.

Select the whole table and hit Ctrl+Shift+F3. In the "Create names from selection" dialog only check "Top Row". Click OK. You have now created some names and they correspond with the names in your headers. (in the screenshot marked Blue.


[TABLE="class: grid"]
<tbody>[TR]
[TD]Row\Col[/TD]
[TD]
A​
[/TD]
[TD]
B
[/TD]
[TD]
C​
[/TD]
[TD]
D​
[/TD]
[TD]
E​
[/TD]
[TD]
F​
[/TD]
[TD]
G
[/TD]
[TD]
H​
[/TD]
[TD]
I​
[/TD]
[/TR]
[TR]
[TD]
1​
[/TD]
[TD]Location
[/TD]
[TD]Task[/TD]
[TD]Description[/TD]
[TD]Labour_Hours[/TD]
[TD]Labor_Costs[/TD]
[TD]Materials[/TD]
[TD]Subs[/TD]
[TD]OH_G_A__Profit[/TD]
[TD]Contract_Amount[/TD]
[/TR]
[TR]
[TD]
2​
[/TD]
[TD]Front Porch[/TD]
[TD]Demolition[/TD]
[TD]Demo garbage, existing windows, steps[/TD]
[TD]
3​
[/TD]
[TD]
€ 8,53​
[/TD]
[TD]
€ 1,51​
[/TD]
[TD]
€ 116,13​
[/TD]
[TD]
€ 60,00​
[/TD]
[TD]
€ 186,17​
[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]Front Porch[/TD]
[TD]Electrical[/TD]
[TD]Properly install wire mold at outlet close to ceiling and exterior light[/TD]
[TD]
5​
[/TD]
[TD]
€ 0,93​
[/TD]
[TD]
€ 351,53​
[/TD]
[TD]
€ 51,87​
[/TD]
[TD]
€ 71,00​
[/TD]
[TD]
€ 475,33​
[/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
7​
[/TD]
[TD]
€ 15,67​
[/TD]
[TD]
€ 96,43​
[/TD]
[TD]
€ 4,99​
[/TD]
[TD]
€ 131,00​
[/TD]
[TD]
€ 248,09​
[/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]Living Room[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new light switch and cover plate[/TD]
[TD]
8​
[/TD]
[TD]
€ 7,98​
[/TD]
[TD]
€ 31,43​
[/TD]
[TD]
€ 38,06​
[/TD]
[TD]
€ 21,00​
[/TD]
[TD]
€ 98,47​
[/TD]
[/TR]
[TR]
[TD]
6
[/TD]
[TD]Living Room[/TD]
[TD]Doors & Windows[/TD]
[TD]Furnish and install new trim and windows (1)[/TD]
[TD]
3​
[/TD]
[TD]
€ 30,09​
[/TD]
[TD]
€ 23,72​
[/TD]
[TD]
€ 76,10​
[/TD]
[TD]
€ 257,00​
[/TD]
[TD]
€ 386,91​
[/TD]
[/TR]
[TR]
[TD]
7
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD]
€ 63,20​
[/TD]
[TD]
€ 504,62​
[/TD]
[TD]
€ 287,15​
[/TD]
[TD]
€ 540,00​
[/TD]
[TD]
€ 1.394,97​
[/TD]
[/TR]
[TR]
[TD]
8
[/TD]
[TD]BedRoom[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new 240V outlet for range and 120V outlet for fridge[/TD]
[TD]
7​
[/TD]
[TD]
€ 29,59​
[/TD]
[TD]
€ 170,88​
[/TD]
[TD]
€ 54,42​
[/TD]
[TD]
€ 214,00​
[/TD]
[TD]
€ 468,89​
[/TD]
[/TR]
[TR]
[TD]
9
[/TD]
[TD]BedRoom[/TD]
[TD]Plumbing[/TD]
[TD]******* sink - Furnish and install new PVC drain, vent and pex supply lines with shut off valves and all sundries for complete install[/TD]
[TD]
4​
[/TD]
[TD]
€ 52,52​
[/TD]
[TD]
€ 59,25​
[/TD]
[TD]
€ 69,53​
[/TD]
[TD]
€ 450,00​
[/TD]
[TD]
€ 631,30​
[/TD]
[/TR]
[TR]
[TD]
10
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
€ 82,11​
[/TD]
[TD]
€ 230,13​
[/TD]
[TD]
€ 123,95​
[/TD]
[TD]
€ 664,00​
[/TD]
[TD]
€ 1.100,19​
[/TD]
[/TR]
[TR]
[TD]
11
[/TD]
[TD]Front Porch[/TD]
[TD]Demolition[/TD]
[TD]Demo garbage, existing windows, steps[/TD]
[TD]
3​
[/TD]
[TD]
€ 242,95​
[/TD]
[TD]
€ 4,98​
[/TD]
[TD]
€ 63,54​
[/TD]
[TD]
€ 60,00​
[/TD]
[TD]
€ 371,47​
[/TD]
[/TR]
[TR]
[TD]
12
[/TD]
[TD]Front Porch[/TD]
[TD]Electrical[/TD]
[TD]Properly install wire mold at outlet close to ceiling and exterior light[/TD]
[TD]
5​
[/TD]
[TD]
€ 46,00​
[/TD]
[TD]
€ 210,80​
[/TD]
[TD]
€ 79,25​
[/TD]
[TD]
€ 71,00​
[/TD]
[TD]
€ 407,05​
[/TD]
[/TR]
[TR]
[TD]
13
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
3​
[/TD]
[TD]
€ 4,27​
[/TD]
[TD]
€ 15,80​
[/TD]
[TD]
€ 36,68​
[/TD]
[TD]
€ 116,13​
[/TD]
[TD]
€ 172,88​
[/TD]
[/TR]
[TR]
[TD]
14
[/TD]
[TD]Living Room[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new light switch and cover plate[/TD]
[TD]
7​
[/TD]
[TD]
€ 38,51​
[/TD]
[TD]
€ 13,42​
[/TD]
[TD]
€ 47,38​
[/TD]
[TD]
€ 51,87​
[/TD]
[TD]
€ 151,18​
[/TD]
[/TR]
[TR]
[TD]
15
[/TD]
[TD]Living Room[/TD]
[TD]Doors & Windows[/TD]
[TD]Furnish and install new trim and windows (2)[/TD]
[TD]
8​
[/TD]
[TD]
€ 211,22​
[/TD]
[TD]
€ 26,61​
[/TD]
[TD]
€ 137,44​
[/TD]
[TD]
€ 4,99​
[/TD]
[TD]
€ 380,26​
[/TD]
[/TR]
[TR]
[TD]
16
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD]
€ 193,37​
[/TD]
[TD]
€ 4,03​
[/TD]
[TD]
€ 23,79​
[/TD]
[TD]
€ 38,06​
[/TD]
[TD]
€ 259,25​
[/TD]
[/TR]
[TR]
[TD]
17
[/TD]
[TD]BedRoom[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new 240V outlet for range and 120V outlet for fridge[/TD]
[TD]
8​
[/TD]
[TD]
€ 37,97​
[/TD]
[TD]
€ 30,34​
[/TD]
[TD]
€ 100,60​
[/TD]
[TD]
€ 76,10​
[/TD]
[TD]
€ 245,01​
[/TD]
[/TR]
[TR]
[TD]
18
[/TD]
[TD]BedRoom[/TD]
[TD]Plumbing[/TD]
[TD]******* sink - Furnish and install new PVC drain, vent and pex supply lines with shut off valves and all sundries for complete install[/TD]
[TD]
9​
[/TD]
[TD]
€ 8,53​
[/TD]
[TD]
€ 47,22​
[/TD]
[TD]
€ 42,70​
[/TD]
[TD]
€ 49,19​
[/TD]
[TD]
€ 147,64​
[/TD]
[/TR]
[TR]
[TD]
19
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
€ 782,82​
[/TD]
[TD]
€ 353,20​
[/TD]
[TD]
€ 531,38​
[/TD]
[TD]
€ 467,34​
[/TD]
[TD]
€ 2.134,74​
[/TD]
[/TR]
[TR]
[TD]
20
[/TD]
[TD]Front Porch[/TD]
[TD]Demolition[/TD]
[TD]Demo garbage, existing windows, steps[/TD]
[TD]
3​
[/TD]
[TD]
€ 15,67​
[/TD]
[TD]
€ 1,27​
[/TD]
[TD]
€ 351,53​
[/TD]
[TD]
€ 69,53​
[/TD]
[TD]
€ 438,00​
[/TD]
[/TR]
[TR]
[TD]
21
[/TD]
[TD]Front Porch[/TD]
[TD]Electrical[/TD]
[TD]Properly install wire mold at outlet close to ceiling and exterior light[/TD]
[TD]
9​
[/TD]
[TD]
€ 7,98​
[/TD]
[TD]
€ 4,41​
[/TD]
[TD]
€ 96,43​
[/TD]
[TD]
€ 29,78​
[/TD]
[TD]
€ 138,60​
[/TD]
[/TR]
[TR]
[TD]
22​
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD]
€ 30,09​
[/TD]
[TD]
€ 93,25​
[/TD]
[TD]
€ 31,43​
[/TD]
[TD]
€ 63,54​
[/TD]
[TD]
€ 218,31​
[/TD]
[/TR]
[TR]
[TD]
23​
[/TD]
[TD]Living Room[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new light switch and cover plate[/TD]
[TD]
7​
[/TD]
[TD]
€ 65,00​
[/TD]
[TD]
€ 27,20​
[/TD]
[TD]
€ 23,72​
[/TD]
[TD]
€ 79,25​
[/TD]
[TD]
€ 195,17​
[/TD]
[/TR]
[TR]
[TD]
24​
[/TD]
[TD]Living Room[/TD]
[TD]Doors & Windows[/TD]
[TD]Furnish and install new trim and windows (3)[/TD]
[TD]
6​
[/TD]
[TD]
€ 29,59​
[/TD]
[TD]
€ 1,36​
[/TD]
[TD]
€ 110,11​
[/TD]
[TD]
€ 36,68​
[/TD]
[TD]
€ 177,74​
[/TD]
[/TR]
[TR]
[TD]
25​
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
5​
[/TD]
[TD]
€ 148,33​
[/TD]
[TD]
€ 127,49​
[/TD]
[TD]
€ 613,22​
[/TD]
[TD]
€ 278,78​
[/TD]
[TD]
€ 1.167,82​
[/TD]
[/TR]
[TR]
[TD]
26​
[/TD]
[TD]BedRoom[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new 240V outlet for range and 120V outlet for fridge[/TD]
[TD]
4​
[/TD]
[TD]
€ 123,83​
[/TD]
[TD]
€ 63,77​
[/TD]
[TD]
€ 59,25​
[/TD]
[TD]
€ 137,44​
[/TD]
[TD]
€ 384,29​
[/TD]
[/TR]
[TR]
[TD]
27
[/TD]
[TD]BedRoom[/TD]
[TD]Plumbing[/TD]
[TD]******* sink - Furnish and install new PVC drain, vent and pex supply lines with shut off valves and all sundries for complete install[/TD]
[TD]
3​
[/TD]
[TD]
€ 242,95​
[/TD]
[TD]
€ 133,00​
[/TD]
[TD]
€ 367,00​
[/TD]
[TD]
€ 23,79​
[/TD]
[TD]
€ 766,74​
[/TD]
[/TR]
[TR]
[TD]
28
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
€ 609,70​
[/TD]
[TD]
€ 352,82​
[/TD]
[TD]
€ 1.173,30​
[/TD]
[TD]
€ 555,94​
[/TD]
[TD]
€ 2.691,76​
[/TD]
[/TR]
[TR]
[TD]
29
[/TD]
[TD]Front Porch[/TD]
[TD]Demolition[/TD]
[TD]Demo garbage, existing windows, steps[/TD]
[TD]
3​
[/TD]
[TD]
€ 4,27​
[/TD]
[TD]
€ 44,15​
[/TD]
[TD]
€ 210,80​
[/TD]
[TD]
€ 42,70​
[/TD]
[TD]
€ 301,92​
[/TD]
[/TR]
[TR]
[TD]
30
[/TD]
[TD]Front Porch[/TD]
[TD]Electrical[/TD]
[TD]Properly install wire mold at outlet close to ceiling and exterior light[/TD]
[TD]
11​
[/TD]
[TD]
€ 38,51​
[/TD]
[TD]
€ 1,66​
[/TD]
[TD]
€ 15,80​
[/TD]
[TD]
€ 1,51​
[/TD]
[TD]
€ 57,48​
[/TD]
[/TR]
[TR]
[TD]
31
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
12​
[/TD]
[TD]
€ 1.019,26​
[/TD]
[TD]
€ 595,40​
[/TD]
[TD]
€ 1.826,15​
[/TD]
[TD]
€ 761,38​
[/TD]
[TD]
€ 4.202,19​
[/TD]
[/TR]
[TR]
[TD]
32
[/TD]
[TD]Living Room[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new light switch and cover plate[/TD]
[TD]
13​
[/TD]
[TD]
€ 193,37​
[/TD]
[TD]
€ 51,87​
[/TD]
[TD]
€ 26,61​
[/TD]
[TD]
€ 96,43​
[/TD]
[TD]
€ 368,28​
[/TD]
[/TR]
[TR]
[TD]
33
[/TD]
[TD]Living Room[/TD]
[TD]Doors & Windows[/TD]
[TD]Furnish and install new trim and windows (4)[/TD]
[TD]
8​
[/TD]
[TD]
€ 37,97​
[/TD]
[TD]
€ 4,99​
[/TD]
[TD]
€ 4,03​
[/TD]
[TD]
€ 31,43​
[/TD]
[TD]
€ 78,42​
[/TD]
[/TR]
[TR]
[TD]
34
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD]
€ 1.293,38​
[/TD]
[TD]
€ 698,07​
[/TD]
[TD]
€ 2.083,39​
[/TD]
[TD]
€ 933,45​
[/TD]
[TD]
€ 5.008,29​
[/TD]
[/TR]
[TR]
[TD]
35
[/TD]
[TD]BedRoom[/TD]
[TD]Electrical[/TD]
[TD]Furnish and install new 240V outlet for range and 120V outlet for fridge[/TD]
[TD]
23​
[/TD]
[TD]
€ 0,21​
[/TD]
[TD]
€ 76,10​
[/TD]
[TD]
€ 47,22​
[/TD]
[TD]
€ 110,11​
[/TD]
[TD]
€ 233,64​
[/TD]
[/TR]
[TR]
[TD]
36​
[/TD]
[TD]BedRoom[/TD]
[TD]Plumbing[/TD]
[TD]******* sink - Furnish and install new PVC drain, vent and pex supply lines with shut off valves and all sundries for complete install[/TD]
[TD]
45​
[/TD]
[TD]
€ 74,60​
[/TD]
[TD]
€ 49,19​
[/TD]
[TD]
€ 26,31​
[/TD]
[TD]
€ 170,88​
[/TD]
[TD]
€ 320,98​
[/TD]
[/TR]
[TR]
[TD]
37​
[/TD]
[TD][/TD]
[TD]Sub-Total[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
€ 1.599,53​
[/TD]
[TD]
€ 880,22​
[/TD]
[TD]
€ 2.187,56​
[/TD]
[TD]
€ 1.342,30​
[/TD]
[TD]
€ 6.009,61
[/TD]
[/TR]
</tbody>[/TABLE]


Now have a look at the screenshot.



In Column K put the names of the tasks. They must be exactly the same as they appear in the task Column B. In M2 make a validated list. Go to:
Data | Data validation | Data validation | Allow > List | Source =$K$2:$K$6

Formula in N2:
=COUNTIF(Task;M2)

On every tab, Electric, Plumbing, HVAC, Doors & Windows etc put something like this:


*** Then in A2 the formula:
=IF(Primary!$M$2="Demolition";IF(ROWS(A$2:A2)<=Primary!$N$2;INDEX(INDIRECT(A$1);SMALL(IF(Task=Primary!$M$2;ROW(Task)-ROW(Primary!$B$2)+1);ROWS(A$2:A2)));"");"")

Which must be entered with Ctrl+Shift+Enter (Excel puts Curly Brackets { } around the formula)
Drag the formula three cells to the right and then down, let's say 50 rows.

Repeat the above (from ***) for every sheet Electric, Plumbing, HVAC, Doors & Windows etc.

The last thing you must do is change the word "Demolition" on every sheet to a name which is on the validated list you made earlier. Remember that these names must be exactly the same as in the validated list AND in column B of your sheet named Primary.

When you choose a task from the validated list, go to the appropiate sheet and there youw ill find the data you want.

P.S. in the formula replace semicolon with comma.
 
Last edited:
Upvote 0
Your set-up is similar. FYI --- The task column in my table is a list. I copied and pasted the formula, made changes to cell references and changed semi-colons to commas. I got a 'value' error. 'Encountered existing arrows or a circular reference'. Most of the formula has locked cells and I can't tell where the curly brackets so I have not had any luck determining what is driving the error.

Here is my formula.
=IF('Original scope assumptions'!$AE$37="Electrical",IF(ROWS(A$2:A2)<='Original scope assumptions'!$AF$37,INDEX(INDIRECT(A$1),SMALL(IF(Task='Original scope assumptions'!$AE$37,ROW(Task)-ROW('Original scope assumptions'!$B$37)+1),ROWS(A$2:A2))),""),"")
 
Upvote 0
Hi Vickie...

Sorry for all the trouble.

Question: When you originally copied/pasted the code into the Visual Basic Editor, did you paste it into a sheet module or a standard module? The code should go into a standard module. (From the Insert menu, choose Module.)

If that isn't it, my next step is to request (if possible) that you post the spreadsheet to a virtual drive (eg, dropbox, onedrive) so I can download and examine it; or if you prefer I can private message you with my email address.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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