Index and match not working over multiple rows

steve1979

New Member
Joined
Nov 4, 2020
Messages
14
Office Version
  1. 365
Platform
  1. Windows
I am trying to use the index and match to find what shift was working on which day.
B18 to AC21 has the values i am looking for.
I can get the index and match to work over one row. (B3-to AC 3 ) i am trying to match a date over the whole range of dates (B3:AC16)
The formula in AF 12 works to select the row, but choosing the column for the date is challenging.
What i would like my formula to do is find the column that has the date i am looking for then indicate what a selected shift would be working.
so for example shift 2 was Do on 13 Dec. i would like the formula to show what they were working on 1 october 2021

PP1 overtime work calc Normal roster REv1.5.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1
2SunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSat
3202113141516171819202122232425262728293031Jan0203040506070809
4 10111213141516171819202122232425262728293031Feb0203040506
5 07080910111213141516171819202122232425262728Mar0203040506
6 07080910111213141516171819202122232425262728293031Apr0203
7 040506070809101112131415161718192021222324252627282930May
8 02030405060708091011121314151617181920212223242526272829
9 3031Jun02030405060708091011121314151617181920212223242526
10 27282930Jul0203040506070809101112131415161718192021222324shift nameshift 1
11 25262728293031Aug0203040506070809101112131415161718192021date13-Dec
12 22232425262728293031Sep0203040506070809101112131415161718was workingM
13 192021222324252627282930Oct020304050607080910111213141516
14 171819202122232425262728293031Nov020304050607080910111213
15 1415161718192021222324252627282930Dec02030405060708091011
1620221213141516171819202122232425262728293031Jan02030405060708
17SunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSat
18Shift 1NdoMMNNDoDoNdoDoDoMMNNNNdoDoDoNdoMMMNNNdoDoDoNdo
19Shift 2NdoDoDoMMNNNNdoDoDoDoMMMNNDoDoDoNdoNdoMMNNDoDo
20Shift 3MNNNdoDoDoNdoNdoMMNNDoDoNdoDoDoMMNNNNdoDoDoNdoMM
21Shift 4NNdoDoDoNdoMMMNNNdoDoDoNdoNdoMMNNDoDoNdoDoDoMMNN
Shift Roster
Cell Formulas
RangeFormula
A3A3=IF(SUMPRODUCT(1*(MONTH(B3:AC3)=1))>=1,YEAR(AC3),"")
C3:AC16C3=B3+1
A4:A16A4=IF(A3="",(IF(SUMPRODUCT(1*(MONTH(B4:AC4)=1))>=1,YEAR(AC4),"")),"")
B4:B16B4=AC3+1
AF12AF12=INDEX(shifts,MATCH(AF10,Shiftsname,0),MATCH(AF11,B16:AC16,0))
Named Ranges
NameRefers ToCells
dcolumns='Shift Roster'!$B$3:$AC$3C3, A3
'Shift Roster'!SHIFT1='Shift Roster'!$B$18:$AC$18AF12
'Shift Roster'!SHIFT2='Shift Roster'!$B$19:$AC$19AF12
SHIFT2='Shift Roster'!$B$7:$AC$7C7, A7
'Shift Roster'!SHIFT3='Shift Roster'!$B$20:$AC$20AF12
'Shift Roster'!SHIFT4='Shift Roster'!$B$21:$AC$21AF12
shifts='Shift Roster'!$B$18:$AC$21AF12
Shiftsname='Shift Roster'!$A$18:$A$21AF12
wdates='Shift Roster'!$B$3:$AC$16C3, A3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B3:AC16,AE15Expression=OR(B3=$A$25:$C$29,B3=$H$25:$J$29,B3=$O$25:$Q$29,B3=$V$25:$X$29)textNO
A21:AC21Expression=($A$22=4)textNO
A20:AC20Expression=($A$22=3)textNO
A19:AC19Expression=($A$22)=2textNO
A18:AC18Expression=($A$22=1)textNO
B3:AC16,AE15Expression="day(b9)<>1"textNO
B3:AC16,AE15Expression=DAY(B3)=1textNO
B2:AC21,AE15Expression=(B$22)="N"textNO
B2:AC21,AE15Expression=(B$22)="M"textNO
B2:AC21,AE15Expression=(B$22)="DO"textNO
B2:AC21,AE15Expression=(B$22)="NDO"textNO
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How about
Excel Formula:
=INDEX(shifts,MATCH(AF10,shiftsname,0),SUMPRODUCT((B3:AC16=AF11)*(COLUMN(B3:AC16)))-1)
 
Upvote 0
Solution
Perfect. Thanks.
I am just not sure how the sumproduct.... works to find the column.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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