Pointing formula group to new references... I think that's what I want to do...

TreatLightly

New Member
Joined
Mar 31, 2018
Messages
2
Hi all,

It's my first time posting here, and I apologise for what will surely be a question full of incorrect vernacular and confusion. I will however be concise.

So: I'm building a roster for event staff - it should be simple, but I got carried away. The first sheet (Schedule)is where start and finish times are entered, and it calculates hours and costs and all that business... here's an image.
open

open

open



The second sheet (Visual)is where I get carried away - it takes the data from the Schedule sheet and creates a visual representation of each crew member's hours across the working day. This will be the printing copy for each event day, to provide an easy reference for others to see who is and isn't on shift. Like this.

It's perhaps a little over the top, but I was in the mood for a challenge. Then I got stuck.

The problem is that it took me a long while to build the formulae to make the Visual sheet work (lots of IFs and some conditional formatting), and yet it only references the first day of the overall schedule on the Schedule sheet (there are 4 weeks in total). I'm wondering if there is an efficient way to "point" the Visual sheet's group of formulae to different days in the Schedule sheet, so that I can quickly choose which day is visually represented at any one time. Does that make sense?

I'm hoping the answer to this is either very simple or it's a fun challenge... unfortunately I've reached the end of my very limited excel knowledge, and research into a solution has got me nowhere. A link to the spreadsheet is here: (in google drive) and the password to the protected cells is "pass". Thanks in advance for anyone having a crack at this!

Cheers,

Matt.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I am so accustomed to Excel dates and times I had to use them in the Schedule entries. I also only used eight crews. My workbook can be downloaded from https://www.dropbox.com/s/k5mgpuraeh4fxi9/treatlightly_gantt.xlsx?dl=0

The Schedules sheet:
f4vujGA.png


I copied the times from Schedule to Visuals, while at the same time I subtracted three hours from those times—'3/24' is three hours to Excel.

BCDEFGHIJKL
4For date18/06/2018
5Week Number 3
6
7Week 1Week 2Week 3Week 4
8StartFinishStartFinishStartFinishStartFinish
9Crew 16:0014:009:0019:00
10Crew 25:0013:0017:0023:00
11Crew 37:0013:0017:0023:004:009:00
12Crew 49:0019:007:0013:00
13Crew 59:0019:0017:0023:00
14Crew 617:0023:009:0019:007:0013:00
15Crew 74:009:00
16Crew 84:009:00

<tbody>
</tbody>
Visuals


Worksheet Formulas
CellFormula
C5=WEEKNUM(GanttDate - 1) - 22
E9=IF(Schedule!C6 = "", "", (Schedule!C6 < 3 / 24) + Schedule!C6 - 3 / 24)
F9=IF(Schedule!D6 = "", "", (Schedule!D6 < 3 / 24) + Schedule!D6 - 3 / 24)

<tbody>
</tbody>

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
GanttDate=Visuals!$C$4

<tbody>
</tbody>

<tbody>
</tbody>

In C5 I corrected for my week beginning on Sunday by subtracting 1 from the date. I found which section of the table to use by subtracting 22 from the WEEKNUM.

I set up the Gantt chart by formatting the cells with a custom number: ";;;" (three semicolons, no quotation marks). This stops any entries from showing in the worksheet or printing, but the entries still appear in the formula bar. This does not affect the conditional formatting: a fill color.

Visuals sheet

Worksheet Formulas
CellFormula
O8=REPT(O$7, AND(ROUND($N8 - 3/24, 6) >= IFERROR(ROUND(INDEX(Weeks, MATCH(O$7, $D$9:$D$16, 0), 1, WeekNumber), 6), 0),
ROUND($N8 - 3/24, 6) <= IFERROR(ROUND(INDEX(Weeks, MATCH(O$7, $D$9:$D$16, 0), 2, WeekNumber), 6), 0)
)
)
N9=N8 + TIME(0, 30, 0)

<tbody>
</tbody>

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
WeekNumber=Visuals!$C$5
Weeks=(Visuals!$E$9:$F$16, Visuals!$G$9:$H$16, Visuals!$I$9:$J$16, Visuals!$K$9:$L$16)

<tbody>
</tbody>

<tbody>
</tbody>

The named formula, Weeks, has four areas, each of eight rows and two columns.
=( range_1, range_2, range_3, range_4)

I used INDEX formulas in the chart to do the lookups:
INDEX( lookup_range, row_to_lookup, column_to_lookup, area_to lookup )

I threw an IFERROR around the INDEX to correct for the unsuccessful lookups. Everything worked except for the comparison at 02:00. I found I was comparing two floating point values that differed at some decimal digit. I tried rounding to six places gave me the proper correction for the floating point error and I did not try to fine-tune the rounding. I was happy with a first-guess success.

The AND evaluates to TRUE or FALSE. Within the REPT formula, TRUE is coerced to 1 and FALSE to 0.
=REPT( string, n_times )
The whole formula tells Excel to repeat the crew name one time if the AND evaluates to TRUE and to repeat the name zero times if the AND evaluates to FALSE.

In Visuals!O8:V48 I used conditional formatting, assigning each crew name to a different color.

IluqGnN.png


u0kgaF0.png
 
Upvote 0
Hi thisoldman,

I'm speechless - thank you so much for your work here... I can't wait to have some time to properly look over just how you've done this! You're incredible!!!
 
Upvote 0
You're welcome. I'm glad to help.

I don't think I explained what I did in the workbook well enough. If you have any questions, post them and I'll get back to you.
 
Upvote 0
Sorry for bringing back this somewhat old thread but I had a question for the solution you've posted.

Why subtract 3 hours from the times? I have a similar roster (here) I'm making (which lead me this is wonderful site) and it is similar to OP, however, some of my "Crew"'s Times begin during the night and finish the morning after e.g. Crew 1 - Start: 23:00, Finish: 07:00.

I think my issue stems from the 3 hour subtraction since currently, I have no time alterations. Adding the alteration passes the first iferror condition but fails the second iferror condition. Additionally, my time scale is from 6:00 to 7:00 the following day with 30-minute intervals.

Everything else works perfectly, just those "Crew members" that work at night do not show up. Any help in this regard is welcomed.
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,315
Members
448,564
Latest member
ED38

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