INDEX and MATCH Function

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
158
I am trying to use the INDEX and MATCH function to look up a date within a range to bring back a annual salary amount. Here is the LOOKUP table which is on a sperate tab in the workbook call Pay_Scales:


Annual Salary Start Date End Date
46395 2018-12-17 2019-05-02
47789 2019-05-03 2019-05-13
50000 2019-05-14 9999-12-31

I am trying to find the salary amount on 2019-07-13 which should be 50K but I am getting #N/A.

Here is my formula:

{=INDEX(Pay_Scales!$A$2:$C$4,MATCH(1,IF(B2>=Pay_Scales!A2:A4,IF(CAS_PLSR!B2<=Pay_Scales!B2:B4,1))),0)}

Can you see my issue? Also, it is possible to put this formula into a loop?

Thanks
 
Ok. I will give it a try. I guess I am making it more difficult than it needs to be. Thank you for your help and patience.
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Ok. I gave it a try and I have something wrong with the formula. Can you see the error?


=LOOKUP(B2,'[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$B$2:$B$102965/'[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$A$2:$A$102965=A2),'[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$G$2:$G$102965)

B2 = the date of OT I want to search the annual salary for (WS # 1)

2020.PRI Basic Pay.v1.RXM'!$B$2:$B$102965 = the start date range in pay table (Different file WS # 2)
2020.PRI Basic Pay.v1.RXM'!$A$2:$A$102965 = The employee number range in the pay table (
Different file WS # 2
)
A2 = the employee number of the date I am searching the annual salary for (WS #1)
2020.PRI Basic Pay.v1.RXM'!$G$2:$G$102965 = Annual salary range in pay table (
Different file WS # 2)

I really appreciate the time and patience you have given me.
 
Upvote 0
Can you see the error?

Hi, you are missing an opening parenthesis here.

Rich (BB code):
=LOOKUP(B2,'[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$B$2:$B$102965/('[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$A$2:$A$102965=A2),'[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$G$2:$G$102965)
 
Upvote 0
Hi, you are missing an opening parenthesis here.

Rich (BB code):
=LOOKUP(B2,'[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$B$2:$B$102965/('[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$A$2:$A$102965=A2),'[2020.PRI Basic Pay.v1.RXM.xlsx]2020.PRI Basic Pay.v1.RXM'!$G$2:$G$102965)


I am getting #N/A as results. I have all the data in the same format. The pay scale table is sorted by Employee number then start date. I have tried to upload sample of the file but it does not like the .xlsx extension.
 
Upvote 0
This is the pay scale table:

Book1
ABCDEFG
1Employee # Start DateEnd DatePay scale groupPS levelWage TypeGross Salary amount
2111112019.04.299999.12.31AU-31100181525
3111112019.04.299999.12.31AU-31100181525
4111112019.04.299999.12.31AU-34100190372
5222222018.09.042019.03.29MG-AFS0591002113721
6222222019.03.302019.07.31MG-AFS0591002113721
7222222019.03.309999.12.31AU-28100191152
8222222019.03.309999.12.31AU-28100191152
9222222019.03.309999.12.31AU-37100199065
10222222019.08.012019.08.30MG-AFS0591002113721
11222222019.08.062019.08.30MG-AFS0591001113721
12222222019.08.319999.12.31MG-AFS0591001113721
13444442018.09.012019.03.29AU-35100293272
14444442018.09.012019.03.29AU-37100299065
15444442018.11.212019.03.29AU-37100199065
16444442019.03.309999.12.31AU-28100191152
17444442019.03.309999.12.31AU-28100191152
18444442019.03.309999.12.31AU-37100199065
19444442019.07.022019.07.12MG-AFS0571002105651
20444442019.08.192019.09.06MG-AFS0571002105651
21555552019.03.162019.03.29AU-471001111682
22555552019.03.182019.03.29AU-571002122276
23555552019.03.182019.03.29AU-571002122276
24555552019.03.302019.12.31AU-571002122276
25555552019.03.302019.12.31AU-571002122276
26555552019.03.309999.12.31AU-471001111682
27555552019.03.309999.12.31AU-471001111682
Pay_Scales


This is the data:
Book1
ABCDEKNO
1Employee # DateOT HoursExpanded OT HoursWage TextAnnual SalaryAnnual Salary Should be
2111112019.05.257.511.25O/T 1st Rest @ 1.5 -Paid#N/A90,372
3222222019.06.02510Travel 2ndRest @2.0-Leave#N/A99,065
4444442019.05.2569O/T 1st Rest @ 1.5 -Paid#N/A99,065
5555552019.05.2723Travel Workday @1.5-Leave#N/A111,682
6555552019.05.317.511.25Travel Workday @1.5-Leave#N/A111,682
CAS_PLSR
Cell Formulas
RangeFormula
K2:K6K2=LOOKUP(B2,Pay_Scales!$B$2:$B$27/(Pay_Scales!$A$2:$A$27=CAS_PLSR!A2),Pay_Scales!$G$2:$G$27)
 
Upvote 0
Hi,

Are your dates proper Excel dates with custom formatting or are they text?

To find out - what do these formula return when placed in a spare cell?
=ISNUMBER(CAS_PLSR!B2)
=ISNUMBER(Pay_Scales!B2)
 
Upvote 0
Hi,

Are your dates proper Excel dates with custom formatting or are they text?

To find out - what do these formula return when placed in a spare cell?
=ISNUMBER(CAS_PLSR!B2)
=ISNUMBER(Pay_Scales!B2)


I get TRUE for CAS_PLSR and FALSE for Pay_Scales even though I have everything formatted as "General".
 
Upvote 0
Hi, I'd have thought it was the other way around! Anyway - I'd suggest to convert the text values to proper dates - one way that would probably work for you is to use the built in find and replace by finding "." and replacing with "-".
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
Members
448,961
Latest member
nzskater

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