Forum Discussion
Vlookup to find multiple variations of a text string
- Apr 24, 2019
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!
- othafaApr 27, 2019Copper ContributorHi, I've now converted the original file to use the formula you gave me but it's not working properly. I'm on a steep learning curve here as I've never worked with arrays before and hardly ever with Index and Match.
Anyway I set up the named ranges for the constants adjusted for the real data and set it going. It correctly gives me the names for the shifts on Monday but just repeats that name for the rest of the week.
I've run the Evaluate Formula feature and as it steps through it everything seems to be going right until the last step when it reverts to the name it gave for Monday.
Any thoughts?- PeterBartholomew1Apr 27, 2019Silver Contributor
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.
- othafaApr 28, 2019Copper ContributorApologies lol. I'm in the UK so was quite late when I read your message. Read it again this morning and made perfect sense. Working perfectly now.
I'm going to need to change some of the shift names as you did with the L & E shift and am checking with my managers if that will have any implications?
One thing I thought of was that since all double shifts have a + between them could we not change the names range "shift" to look for that as a wildcard? I tried "*+"&range&"+*" but that didnt work.
Thanks again for your help.
- Detlef_LewinApr 26, 2019Silver Contributor
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.
- othafaApr 26, 2019Copper Contributor
Detlef_Lewin PeterBartholomew1
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.
- SergeiBaklanApr 25, 2019Diamond Contributor
- PeterBartholomew1Apr 25, 2019Silver Contributor
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).
- SergeiBaklanApr 27, 2019Diamond Contributor
PeterBartholomew1 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.