04-24-2019 06:33 AM
Hi, first time post here so bear with me!
I am trying to create a worksheet that displays a list of shift types with names of staff allocated that shift over the period of a week.
I can do this for straightforward shifts but occasionally we have to ask staff to double up on shifts and the vlookup formula I am using wont find the double shifts.
The problem is that there are too many possible combinations of double shifts for me to list them all on the worksheet so I need a formula that can find any possible combination and display the staff member who has been allocated it?
Sample File attached.
Thanks
04-24-2019 09:25 AM
Solution04-24-2019 09:52 AM
Thanks for this, it certainly does what I want.
Is there a way to convert sheet 1 into the table (A1:C24) you created in Tabelle1. I ask because the format of sheet1 is fixed as it is?
Thanks.
04-24-2019 10:11 AM
That is the PQ part. Goto to the PQ editor to see the queries and steps.
To load the table into PQ I assigned a name to the table range (-> name manager),
04-24-2019 10:36 AM
04-24-2019 11:13 AM
You need to refresh.
First refresh the PQ table -> right click -> refresh.
Then refresh the pivot table -> right click -> refresh.
04-24-2019 11:31 AM
04-24-2019 12:06 PM
04-24-2019 12:30 PM
04-25-2019 05:20 AM
Hi, many apologies but I've hit a snag. When I was working on your fix for the problem I was using my home version of excel which is Microsoft Office 2016. Unfortunately the version at work is Office Standard 2010 and reading up on it online the Power Query is not available for this version, only the professional plus 2010.
What this means is that I don't get the option of adding the data to the data model when I create the pivot table.
Back to square one?
04-25-2019 12:50 PM
@othafa wrote:Back to square one?
So it seems.
Or you could argue with your boss and your IT that with a more recent version of Excel you will be able to perform this specific task easily.
And besides Excel 2010 is almost 10 years old.
04-25-2019 02:45 PM
A formula solution. The key element is to perform a wildcard search for anything that contains a shift name, e.g. search for "*LMP*". There is a catch that the abbreviations for Early and Late are to be found within other shift codes so I converted them to "E0" and "L0" to avoid 'false positives'.
= IFERROR( INDEX( Name, MATCH( shift, INDEX(shiftTable, 0, day), 0 ) ), "" )
The names 'day' and 'shift' are relative references and the innermost INDEX returns the 3 rows for a given day of the table.
As for your other line of exploration, Power Query is available as an Office 2010 add-in free of charge from Microsoft. Your IT department could install it for you and I would recommend that they evaluate it themselves!
04-25-2019 03:56 PM
04-25-2019 04:08 PM
For me, what the documentation suggests and what actually happened were not the same thing. Power Query and Power Pivot both installed despite my not having the correct version of Office.
Now I am using Office 365 insider but that is because I was desperate to evaluate modern Dynamic Arrays (they are superb and now provide the basis of everything I do outside Power Query).
04-25-2019 09:49 PM
Did you compare your solution with my solution?
Your missing some shifts: DO, LMP1.
And your missing multiple names for the same shift on the same day.
And LMP produces false positives because of LMP1 and LMP2.
04-26-2019 12:04 AM
@Detlef Lewin @Peter Bartholomew
Peter's solution looks good, I'll need to run it in the real schedule obviously to test it.
Not concerned if it doesnt pick up DO as those are days off which we don't need to display on sheet 2 (in Peter's solution I was intending to deselect DO and AL in the filter section of the pivot table using a macro) but would be concerned if it doesnt pick up duplicates at all.
My bad, the LMP should be LMP1 but we only use a number in shift codes if there are two people doing the same shift. In other words there is a CWE but will never be a CWE1 or CWE2. I think Ive just resolved the duplicate issue....the only duplicates we do use are the E and L shifts and we could possibly number them so no need to call them EO and LO.
Ill try the download myself but company admin privaledges may prevent me doing that, if so and I get someone in IT to look at it for me they may just come back and tell me it wont work!
Watch this space and thanks again for the help.
04-27-2019 07:03 AM
04-27-2019 08:19 AM
@Peter Bartholomew wrote:
For me, what the documentation suggests and what actually happened were not the same thing. Power Query and Power Pivot both installed despite my not having the correct version of Office.
Now I am using Office 365 insider but that is because I was desperate to evaluate modern Dynamic Arrays (they are superb and now provide the basis of everything I do outside Power Query).
Hi Peter,
Yes, I agree with both.
Documentation could be outdated. That was with "Where is Power Pivot" when expanding of Power Pivot on all SKU was announced first on uservoice, and doc was updated only in a while. Sometimes delay could be quite significant. However, I don't think there were some changes for outdated 2010.
Power Query becomes less important if you work within one notebook. My main scenarios of usage is to pick-up and transform data from different sources (SQL databases, files on SPO and like) to combine in one workbook with its local data. That was I did with Pivot Table connectors long ago, now PQ is the main tool.
04-27-2019 02:27 PM
The catch might be that 'day' is a relative reference to the indices 1,...7 above the table. To get a fresh value for each column, the array formula is applied to a single column and then copied across to give a set of 7 array formulas rather than one single array formula.
04-27-2019 04:06 PM
04-28-2019 05:19 AM
04-28-2019 02:59 PM
@othafa wrote:
I tried "*+"&range&"+*" but that didn't work.
I think you were within a whisker of getting it to work though. If you pad both the lookup value and the lookup array with leading and trailing "+"s, you will find the strings you are searching for but "+L+" is not present in "+LMP+". You will also locate it successfully within "+L+N+", just as you want.
p.s. I seem to have had different versions of the workbook. The attached uses a relative reference within the formula for 'shift' which allows the worksheet formulas to be entered without CSE.
04-28-2019 03:35 PM
I liked the reference to the Bill Jelen podcast. I have yet to get around to using measures and DAX so perhaps this will encourage me to seek out new problems where I can use it!
04-29-2019 04:18 AM
04-29-2019 04:54 AM
Oops! My fault.
I clearly changed the worksheet but uploaded it before saving!
The version I am now about to post picks up both the day and the shift code by relative referencing. Each cell requires a reference to be made to the 'shiftTable' but padded with "+". If this 'padding' were done in a worksheet formula this would require CSE but by hiding it away in the Named Formula the array operation happens by default.
I apologise for changing strategy mid-stream; it is not a good teaching style!
04-29-2019 07:04 AM