Offset Function Problems

theglassviolin

New Member
Joined
Jun 21, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I'm trying to calculate time for our department when people pick up shifts. I was trying to have it automatically pull the hours they worked by having the formula to find their name (like in the count option) offset it three cells to the right for that value, and then add all of those individual shifts of that same staff together. The problem is that offset seems to only be able to reference one cell and can't have it locate specific values. Since staff is picking up different shifts, I'm plugging them all over the place but would like to have it automatically calculate their time when plugged into a shift.

Any and all help would be greatly appreciated.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Could you provide a small example showing what your worksheet looks like, specifically where the names are listed, where the name to be found is located, and where the shifts/hours are located? If possible, use the XL2BB add-in to post the example.
 
Upvote 0
Could you provide a small example showing what your worksheet looks like, specifically where the names are listed, where the name to be found is located, and where the shifts/hours are located? If possible, use the XL2BB add-in to post the example.
Oh man, I don't know what XL2BB add-in even is, I'm sorry.

Attached is a screen shot. I want the system to be able to pull the hours associated with the name that is put into that shift. So if I put "Piper" in a shift, the time calculates fine, but I would like to be able to pull the hours directly into another cell that adds up all of the hours specific to that one employee. I'm not even sure if that's something that can be automated with the way I have it laid out.

I tried to make it offset three columns from the name (to grab the hours) and then add all of the hours together, that way any time I plugged in someone's name it would know to grab the total hours (which is three columns away), but unfortunately offset only works with specific cells. Below all of this I have all of my employees listed and have been manually adding their hours together, which works, but clearly offers itself to human error.

Thank you for responding.
 

Attachments

  • example.jpg
    example.jpg
    83.8 KB · Views: 6
Upvote 0
A link in my signature block will take you to a page that describes the XL2BB add-in, offers installation help, and provides a link for downloading the add-in. Assistance and resolution of problems are greatly facilitated when the add-in is used to exchange worksheet structure, formulas, etc. I still do not understand where you want the results to appear. Below is an idea that creates a list of all names appearing in column A and then the total hours for each name are determined with a formula. In this example, the time duration in column D is expressed in hours:minutes, but Excel internally treats this as a number expressed as some fraction of a day (so 12 hours...12:00...is 0.5 days). So when the total hours are summed, Excel is expressing the total in terms of days; therefore the results are multiplied by 24 to yield hours.
Book5
ABCDEFGHI
1Sunday, June 18th AMCoverage AnalysisStaffTotal Hours
2Name:StartStopHoursRoleAZName1 Piper (AZ, IN, TN, AR, NC28.00
3Name1 Piper (AZ, IN, TN, AR, NC6:0018:0012:00TLINName2 (TN, AK)12.00
4Name2 (TN, AK)7:0019:0012:00TNName312.00
5Name37:0019:0012:00BHUARName4 (IN, TN, AR, NC, NM)21.25
6Name4 (IN, TN, AR, NC, NM)7:0019:0012:00NCName5 (AZ, TN, NM)24.00
7Name5 (AZ, TN, NM)7:0019:0012:00NMName6 (AZ, IN, TN, AR, NM24.00
8Name6 (AZ, IN, TN, AR, NM7:0019:0012:00ALName7 (AZ, IN, TN, NC, AL, AK)24.00
9Name7 (AZ, IN, TN, NC, AL, AK)7:0019:0012:00AKName8 (TN, AK)12.00
10Name912.50
11Monday, June 19th PMCoverage Analysis
12Name:StartStopHoursRoleAZ
13Name1 Piper (AZ, IN, TN, AR, NC6:0022:0016:00TLIN
14Name8 (TN, AK)7:0019:0012:00TN
15Name97:0019:3012:30BHUAR
16Name4 (IN, TN, AR, NC, NM)10:0019:159:15NC
17Name5 (AZ, TN, NM)7:0019:0012:00NM
18Name6 (AZ, IN, TN, AR, NM7:0019:0012:00AL
19Name7 (AZ, IN, TN, NC, AL, AK)7:0019:0012:00AK
Sheet4
Cell Formulas
RangeFormula
H2:H10H2=SORT(UNIQUE(FILTER(A:A,(A:A<>"")*(A:A<>"Name:"))))
D3:D9,D13:D19D3=C3-B3
I2:I10I2=24*SUMIF(A:A,H2,D:D)
Dynamic array formulas.
 
Upvote 0
That's odd...are you using Excel 365? The SORT function is not essential, but it would make the list of staff easier to use.
 
Upvote 0

Forum statistics

Threads
1,215,409
Messages
6,124,733
Members
449,185
Latest member
hopkinsr

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