Data lookup based on multiple conditions without using CSE

JHE1969

New Member
Joined
Apr 2, 2018
Messages
11
I have a data table of dates, first names, surnames and salary. I need to be able to lookup the salary on or before a given date. I need to do this multiple times so do not want to use the Control Shift Enter array construct. Any suggestions for a single line formula that can deal with the data conditionality. An example table is below:

DateFirstNameSurnameSalary
01/01/2018JohnSmith102
01/02/2018JackJones98
01/03/2018JillSmith52
01/04/2018TomJones69
01/05/2018TomSmith12
01/06/2018JohnSmith103
01/06/2018TonyJones54
01/06/2018JillSmith270
01/07/2018JillJones103
01/07/2018JackJones120
01/08/2018JillJones78
01/09/2018TonySmith83
01/10/2018TomJones47
Date01/09/2018
FirstNameTom
SurnameSmith
Salary

<colgroup><col width="87" span="4" style="width: 65pt;"></colgroup><tbody>
</tbody>
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
What does "on or before" mean? If the individual got a raise on the specified date, he makes more money on that date than the day before.
 
Upvote 0
Assuming the intent is what they were making on the specified date,

A​
B​
C​
D​
E​
1​
Date
FirstName
Surname
Salary
2​
1/1/2018​
JohnSmith
102​
3​
1/2/2018​
JackJones
98​
4​
1/3/2018​
JillSmith
52​
5​
1/4/2018​
TomJones
69​
6​
1/5/2018​
TomSmith
12​
7​
1/6/2018​
JohnSmith
103​
8​
1/6/2018​
TonyJones
54​
9​
1/6/2018​
JillSmith
270​
10​
1/7/2018​
JillJones
103​
11​
1/7/2018​
JackJones
120​
12​
1/8/2018​
JillJones
78​
13​
1/9/2018​
TonySmith
83​
14​
1/10/2018​
TomJones
47​
15​
16​
17​
1/9/2018​
TomSmith
12​
D17: =INDEX($D$2:$D$14, MATCH(1, INDEX((A17 >= $A$2:$A$14) * (B17 = $B$2:$B$14) * (C17 = $C$2:$C$14), 0), 0))
 
Last edited:
Upvote 0
to clarify I'm not trying to find their current salary I want to find their last payment i.e. the final column is not their salary p/a but individual salary payments. by way of example if I entered Jack Jones and 1/6/18 I would want to return 98 but if I changed date to 1/7/18 then I would want to return 120. does that make sense ?
 
Upvote 0
A​
B​
C​
D​
E​
1​
Date
FirstName
Surname
Salary
2​
1/1/2018​
JohnSmith
102​
3​
1/2/2018​
JackJones
98​
4​
1/3/2018​
JillSmith
52​
5​
1/4/2018​
TomJones
69​
6​
1/5/2018​
TomSmith
12​
7​
1/6/2018​
JohnSmith
103​
8​
1/6/2018​
TonyJones
54​
9​
1/6/2018​
JillSmith
270​
10​
1/7/2018​
JillJones
103​
11​
1/7/2018​
JackJones
120​
12​
1/8/2018​
JillJones
78​
13​
1/9/2018​
TonySmith
83​
14​
1/10/2018​
TomJones
47​
15​
16​
17​
1/6/2018​
JackJones
98​
D17: =LOOKUP(9E+307, $D$2:$D$14/((A17>=$A$2:$A$14)*(B17=$B$2:$B$14)*(C17=$C$2:$C$14)))
18​
1/7/2018​
JackJones
120​
 
Upvote 0
That's great, what is the first argument in the LOOKUP ?
A​
B​
C​
D​
E​
1​
Date
FirstName
Surname
Salary
2​
1/1/2018​
JohnSmith
102​
3​
1/2/2018​
JackJones
98​
4​
1/3/2018​
JillSmith
52​
5​
1/4/2018​
TomJones
69​
6​
1/5/2018​
TomSmith
12​
7​
1/6/2018​
JohnSmith
103​
8​
1/6/2018​
TonyJones
54​
9​
1/6/2018​
JillSmith
270​
10​
1/7/2018​
JillJones
103​
11​
1/7/2018​
JackJones
120​
12​
1/8/2018​
JillJones
78​
13​
1/9/2018​
TonySmith
83​
14​
1/10/2018​
TomJones
47​
15​
16​
17​
1/6/2018​
JackJones
98​
D17: =LOOKUP(9E+307, $D$2:$D$14/((A17>=$A$2:$A$14)*(B17=$B$2:$B$14)*(C17=$C$2:$C$14)))
18​
1/7/2018​
JackJones
120​

<tbody>
</tbody>
 
Upvote 0
When Excel does arithmetic operations (here, multiplication) with Boolean expressions, in converts TRUE to 1 and FALSE to 0, so the lookup array is a bunch of 0s and 1s. The 1 is the lookup value.

However, you want the formula in post 5.
 
Upvote 0
When Excel does arithmetic operations (here, multiplication) with Boolean expressions, in converts TRUE to 1 and FALSE to 0, so the lookup array is a bunch of 0s and 1s. The 1 is the lookup value.

However, you want the formula in post 5.

Yep the formula in Post 5 works perfectly, thanks so much. Could I ask for an explanation as to the format of the LOOKUP please so I learn how to use this better going forward. Thanks again !
 
Upvote 0
The lookup vector contains the salary amounts when the names match and the specified date is >= the dates in the table, and a #DIV/0 error otherwise.

The LOOKUP function, which has a lookup value larger than any possible result, matches the last value where those conditions are true.

There's no need to quote my posts back to me.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,536
Members
449,037
Latest member
tmmotairi

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