Using Vlookup and Contains to find the latest date

bogusnews

New Member
Joined
Mar 17, 2019
Messages
6
Hi everyone.
I run a window cleaning company. I have two pages on my spreadsheet, one with a list of invoices, the other with customers. They usually have regular work. So I want a column in the customer sheet to be constantly looking at the invoice list.

Everytime a new invoice is entered, I want the customer sheet to capture the date of the work. I adjusted a formula I found here to this: =VLOOKUP("*"&D4&"*",'Invoices - Main'!C$6:D500,2,FALSE)
where D4 contains the customer name. The array in on the "invoice-main" sheet and the "2" of course contains the invoice date.

This works well, but unfortunately it just chooses the first date it finds. Is there a way for it to choose the last date for the customer?

Thanks so much for your help.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Excel 2016 (Windows) 32 bit
A
B
C
1
.
2
.
3
NameLast date Formula in B4
4
Name_01
15/03/2019​
=MAXIFS('Invoices - Main'!$D$6:$D$500,'Invoices - Main'!$C$6:$C$500,A4)
5
Name_02
13/03/2019​
6
Name_03
11/03/2019​
7
Name_04
13/03/2019​
Sheet: Customers


Excel 2016 (Windows) 32 bit
A
B
C
D
1
.
2
.
3
.
4
..
5
Customerdate
6
Name_02
10/03/2019​
7
Name_03
10/03/2019​
8
Name_03
10/03/2019​
9
Name_04
10/03/2019​
10
Name_04
10/03/2019​
11
Name_02
11/03/2019​
12
Name_03
11/03/2019​
13
Name_03
11/03/2019​
14
Name_03
11/03/2019​
15
Name_01
12/03/2019​
16
Name_01
13/03/2019​
17
Name_01
13/03/2019
18
Name_02
13/03/2019​
19
Name_02
13/03/2019​
20
Name_02
13/03/2019
21
Name_04
13/03/2019​
22
Name_04
13/03/2019​
23
Name_04
13/03/2019
24
Name_01
14/03/2019​
25
Name_01
14/03/2019​
26
Name_01
15/03/2019
27
.
Sheet: Invoices - Main
 
Upvote 0
Thank you. I tried this. It seems to be giving the answer of 0/01/1900.

Some more information... I've used the MS invoice tracker template. It has hard wired in it to connect the customer number along with the customer name in the invoice - main page. So a client called "Service King" is treated as "60 - Service King". This may be causing me problems perhaps...?

Thank you again for your prompt response
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,272
Members
448,558
Latest member
aivin

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