Index/Match with multiple criteria and IF function

SteveNL86

Board Regular
Joined
Nov 11, 2014
Messages
109
Office Version
  1. 2016
Platform
  1. Windows
Dear reader,

I'm trying to match 2 tables to quickly put the right amount of hours behind a certain shift.

So I got this table with the hours:
ShiftMaDiWoDoVrZaZoFd/fst
AW5,55,55,55,55,5242424
NAC5,55,55,55,55,5677
NAV66666777
NDC100000888

And I got an employee shift page like this:
DateDayCodeShiftHours
09-01-2018diAWAW wk5,5
21-01-2018zoNACNAC fd7
02-02-2018vrNACNAC wk5,5
08-03-2018doNAVNAV wk6
17-03-2018zaNDC1NDC1 wknd8
04-04-2018zaNACNAC wknd6

So if the shift column contains "fst" or "fd" it should grab the hours from the fd/fst column corresponding to the right shift code. If the shift description doesn't contain "fd" or "fst" it should grab the hours from the corresponding day and shiftcode.

I'm having trouble getting this to work in hours column.
Any help is much appreciated!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Is you table of shift hours a structured table or just a normal range?
 
Upvote 0
Thanks Fluff, I've done so immediatly.

The table is just a normal range.
 
Upvote 0
Ok, thanks for that, how about
+Fluff v2.xlsm
ABCDEFGHI
1ShiftMaDiWoDoVrZaZoFd/fst
2AW5.55.55.55.55.5242424
3NAC5.55.55.55.55.5677
4NAV66666777
5NDC100000888
Main

+Fluff v2.xlsm
MNOPQ
1DateDayCodeShiftHours
209/01/2018diAWAW wk5.5
321/01/2018zoNACNAC fd7
402/02/2018vrNACNAC wk5.5
508/03/2018doNAVNAV wk6
617/03/2018zaNDC1NDC1 wknd8
704/04/2018zaNACNAC wknd6
Main
Cell Formulas
RangeFormula
Q2:Q7Q2=INDEX($B$2:$I$5,MATCH(O2,$A$2:$A$5,0),IF(MAX(--ISNUMBER(SEARCH({"fd","fst"},P2))),8,MATCH(N2,$B$1:$I$1,0)))
 
Upvote 0
Solution
Thanks Fluff!

I'm struggling a little bit getting it to work in my worksheet. After adapting it to my sheets it does grab the right hours on the sundays (zo) but I get a #N/a in every other row.
 
Upvote 0
I figured it out. Amazing! Very much appreciated Fluff, your awesome!
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

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