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.
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,781
Office Version
  1. 365
Platform
  1. Windows
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
 

bogusnews

New Member
Joined
Mar 17, 2019
Messages
6
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
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,781
Office Version
  1. 365
Platform
  1. Windows
thanks for your feedback
(y)
 

Watch MrExcel Video

Forum statistics

Threads
1,109,444
Messages
5,528,798
Members
409,835
Latest member
Mafu1267

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top