How to Look up account number in one sheet and compute total work hours from multiple workorders

jsadler04

New Member
Joined
Jan 13, 2017
Messages
3
I am very new to excel and have been working on this problem for 10 hours but can not seem to a understand vlookup and sumif, and how to properly apply if. Have a spreadsheet with two sheets named Customers and WorkOrderTime. Need to compute total hours worked for each account by matching the account number to each work order then adding the total hours worked from all orders.

Customers Sheet
Account NameAccountNumberTotal Hours
Customer10
Customer212345
Customer3123456
Custoimer4176134
Customer5219872
Customer6219926
Customer7484336
Customer8552300
Customer9598106
Customer10600058#VALUE!

<tbody>
</tbody>

WorkOrderTime

AccountNumber WO TypeTravelLaborTotalHoursDate WorkedBillable StatusActivity
123434Service1.003.004.006/21/2016Fee For ServiceRepair
234567Service1.003.004.006/21/2016No ChargeRepair
344565Service1.003.004.006/20/2016Fee For ServiceRepair
489023Service0.002.502.506/21/2016Fee For ServiceRepair
598106Service3.007.0010.0012/15/2016Fee For ServiceRepair
598106Service3.003.006.0011/7/2016Fee For ServiceRepair
600058Implementation0.008.008.0011/30/2016Professional ServiceSoftware Install & Configuration
600058Implementation1.008.009.0011/28/2016Professional ServiceSoftware Install & Configuration
600058Implementation0.008.008.0011/23/2016Professional ServiceSoftware Install & Configuration
600058Implementation1.008.009.0011/21/2016Professional ServiceInfrastructure Installation
600058Implementation0.001.001.0011/9/2016ContractUpgrade
600058Implementation6.002.008.0010/19/2016ContractUpgrade
600058Implementation2.006.008.0010/18/2016WarrantyUpgrade
600058Implementation7.000.007.0010/17/2016WarrantyUpgrade
600058Implementation1.008.009.006/28/2016Professional ServiceSoftware Install & Configuration
600058Service0.002.502.506/21/2016Fee For ServiceRepair
600058Service1.003.004.006/21/2016No ChargeRepair
600058Service1.003.004.006/21/2016Fee For ServiceRepair
600058Service1.003.004.006/20/2016Fee For ServiceRepair
600058Service0.001.001.006/20/2016Fee For ServiceConsulting
3454324Service0.001.001.006/20/2016Fee For ServiceConsulting

<tbody>
</tbody>


I am using the following function: =SUMIF(WorkOrderTime,VLOOKUP(B11,WorkOrderTime,5,FALSE)) and getting an invaild number or it will give me the first value but it will not total all values associated to the account number. I am hoping someone could point me in the right direction, thanks.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Maybe this, where it returned 82.5.

You may want to use some absolute referencing on the cell ranges.

Howard

Code:
=SUMIF(A17:A37,B11,E17:E37)
 
Upvote 0
Howard,

I will definitely try this out today and let you know how it works out. Really hope this is the solution because my original spreadsheet has over 20,000 records. Guess, I should stop volunteering for stuff like this but it is a learning experience.
 
Upvote 0
With 20,000 rows you may want to try this snippet.

Does 100,000+ rows in about 1.5 seconds on my computer.

Adjust sheet names to your workbook and I used your posted data format on sheets 7 and 8.
If the data on sheet 8 is a fixed range, then you can use the formula line that is commented out. Otherwise, use the one with lRow8 it.
The : .Value = .Value returns the formula value only, there will be no formulas on the worksheet.

Copy to a standard module.

Howard

Code:
Option Explicit

Sub my_Long_Column()

  Dim lRow7&
  Dim lRow8&
  
  lRow7 = Sheets("Sheet7").Cells(Rows.Count, "B").End(xlUp).Row ''Note is column B Sheet7 for row count
  lRow8 = Sheets("Sheet8").Cells(Rows.Count, "A").End(xlUp).Row ''Note is column A Sheet6 for row count
  
   'MsgBox lRow7 & " " & lRow8
  
  With Sheets("Sheet7").Range("C2").Resize(lRow7 - 1) ''Returning values in column C, Sheet 7
  
    '.Formula = "=SUMIF(Sheet8!$A$2:$A$22,B2,Sheet8!$E$2:$E$22)": .Value = .Value
    .Formula = "=SUMIF(Sheet8!$A$2:$A$" & lRow8 & ",B2,Sheet8!$E$2:$E$" & lRow8 & ")": .Value = .Value
    
  End With

End Sub
 
Upvote 0
Howard,

Thanks for the information, I will try this today and let you know the outcome. Looks like I really need to take a good excel class to be able to this on my own. any suggestions?
 
Upvote 0
As far as I can see there is no need for the VLOOKUP?, just use the SUMIF ?
 
Upvote 0

Forum statistics

Threads
1,216,151
Messages
6,129,162
Members
449,489
Latest member
spvclub

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