Lookup Values across multiple tables

Falko26

Board Regular
Joined
Oct 13, 2021
Messages
89
Office Version
  1. 365
Platform
  1. Windows
All,

I'm trying to lookup and return the "Average: Total / Hr" value from a specific table based on the Crew Description.

Is there a way to do a type of lookup for that value?

I can VLOOKUP the crew description to get to the column I desire. Is there then a way to look down until first cell that says "Average:" and return the cell directly to the right of that or something?

1645123865463.png
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Maybe something like this with the CHOOSE function.

Book1
ABCDE
1IDCrewRate
212 Man Roust$ 65.00
323 Man Roust$ 62.00
434 Man Roust
545 Man Roust
6
7
82 Man Roust
9IDTradeCountRateTotal
101Foreman
112Laborer
12Average$ 65.00
13
143 Man Roust
15IDTradeCountRateTotal
161Foreman
172Laborer
18Average$ 62.00
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=CHOOSE(LEFT(B2,1),"",$E$12,$E$18)
 
Upvote 0
Thanks for the reply AhoyNC!

So this is on the right track. Now the only trick is the CHOOSE values selected can increase in number with more crews added below and change there row # location. If I add a crew line item to the main table above the individual crew tables below will shift down thus changing the row they are in. So I cant just select every average value outright I need some way to look for all averages.

If it helps every crew is in its own Excel Table.

I didn't know if there was a way to look for table based on crew name then return a specific cell in the "Total" row of the table? or something like that.
 
Upvote 0
It looks like all of the data is on one worksheet. So assuming that "Sheet1" contains the data, cell A1 contains the header "CREW RATES", cell A9 contains the header "2 MAN ROUST", and so on, try the following . . .

1) First define the following names (Ribbon >> Formulas >> Defined Names >> Name Manager). Change the sheet name accordingly.

VBA Code:
Name:  BigNum
Refers to:  =MATCH(9.99999999999999E+307,'Sheet1'!$E:$E)

Name:  TablesRange
Refers to:  ='Sheet1'!$A$9:INDEX('Sheet1'!$H:$H,BigNum)

2) Then enter the following formula in C3, confirm with CONTROL+SHIFT+ENTER, and copy down. (Actually, since you're using Office 365, there's no need to confirm the formula with CONTROL+SHIFT+ENTER. You only need to confirm with just ENTER.)

VBA Code:
=INDEX(TablesRange,SMALL(IF(INDEX(TablesRange,0,4)="Average:",IF(ROW(TablesRange)-MIN(ROW(TablesRange))+1>MATCH(B3,INDEX(TablesRange,0,1),0),ROW(TablesRange)-MIN(ROW(TablesRange))+1)),1),5)

Note that the defined range will automatically adjust when you add other tables below the existing ones.

Hope this helps!
 
Last edited:
Upvote 0
Domenic Thank you for the detailed response!

Ok I'm adding more pictures so you can see rows, columns, & Sheet Names as I adapt your method.

I am getting pop up windows explorers each time I enter the formula into the cell that says "Update Values: Rates"? also when I enter the defined named ranges the first time a window pops up.

Results in a "#NAME?" Error.

Did I miss something? I am working with Excel Tables for everything...

BigNum:
1645201123312.png


TableRange:
1645201347054.png


Formula:
1645201593725.png
 
Upvote 0
Since your sheet name has a space, it needs to be within single quotes, like this . . .

VBA Code:
Name:  BigNum
Refers to:  =MATCH(9.99999999999999E+307,'Labor Rates'!$E:$E)

I'll edit my post accordingly.
 
Upvote 0
Are these manually created tables? Or are they in fact tables created by going to Ribbon >> Insert tab >> Tables group >> Tables ?
Originally they were manually created, however as I add new crews I have a macro that simply copies the "2 Man Roust" Table and Pastes it underneath the last crew table. I then need to figure out how to format it from there to make it a "Blank Table". But that's another question.

Ultimately I'm trying to make a Crew Builder tool for my company so the construction manager can "Press Buttons" and create a rate calculator of sorts.

VBA Code:
Sub BLC_CreateCrewTable()

Range("Table_2Roust[#All]").Copy Range("B" & Rows.Count).End(xlUp).Offset(4)
     
End Sub
 
Last edited:
Upvote 0
I see that those are in fact actual Tables. So I'll take another look when I get a chance. I may have an alternative solution. I'll have to see. If so, I'll post it.

At the same time, someone else here may have another solution. So stayed tuned. :)
 
Upvote 0
Okay, I have taken a closer look at your sample workbook, and I see that there's an issue. It looks like each cell in Column E that contains the label "Average:" actually has a leading and trailing space. So the formula needs to be adjusted. Give me a moment, and I'll post the amended formulas, as per your sample workbook.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

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