Forum Discussion
Vlookup to find multiple variations of a text string
- Apr 24, 2019
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?
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.- PeterBartholomew1Apr 28, 2019Silver Contributor
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.
- othafaApr 29, 2019Copper ContributorSorry you've lost me now. The sheet you sent in your last message has this formula in each cell of the table on sheet 2 {=IFERROR( Name, MATCH( shift, "+"&INDEX(shiftTable, 0, day)&"+", 0 ) ), "")} which looks like an array and which I can only replicate by using CSE which you say in your last paragraph is not necessary. I have amended the shift formula so it's the same as that in the sheet you attached?
When I do that however it now gives me the correct name in the first row but then replicates those names for the remaining rows.
Sorry to still be struggling with this!
- othafaApr 27, 2019Copper ContributorNot sure I follow but cant understand why you fix on my example works but it wont work on the real data.
Was wondering if there is an issue with shifts in the source data that don't appear in the left hand column of sheet2?
There are about 50 core shifts and while these might appear in the source data I haven't yet been able to ensure that they all appear in the shift column on sheet 2.