Lookup of the latest date arrival date

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
343
Office Version
  1. 365
Platform
  1. Windows
Sirs/Ma'ams,


I have a long range of column table, in which, dates as column header. Under each column, there is number 2=Arrival, 1=Departure and 3=whole day.

I would like to lookup for the latest date of arrival, if the return value is a column header?..

SAMPLE.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
12= ARRIVAL
21= DEPARTURE
33=WHOLE DAY
4BLUE=CURRENT DATE
5AUGUST 2022
6NAME#DEPT01020304050607080910111213141516171819202122232425262728293031
7NAME 11HR23333
8NAME 22HR2333
9NAME 33HR23333333333333333333
10NAME 44HR
11NAME 55HR33333333333333331
12NAME 66ADMIN
13NAME 77ADMIN
14NAME 88ADMIN331
15NAME 99ADMIN2333
16NAME 1010OPERATIONS23333331
17NAME 1111OPERATIONS3333333331
18NAME 1212OPERATIONS33333331233333
19NAME 1313OPERATIONS233333333333331
20NAME 1414OPERATIONS
21NAME 1515OPERATIONS3333333333331
22NAME 1616ACCTG23333333333
23NAME 1717ACCTG3312333
24NAME 1818ACCTG233333333333333333
25NAME 1919ACCTG233333333333333333
26NAME 2020ACCTG23333331
27NAME 2121ACCTG3312333
28NAME 2222WHSE233333333333331
29NAME 2323WHSE23333333333
30NAME 2424WHSE233333333333333333
31NAME 2525WHSE2333
32NAME 2626WHSE1
33NAME 2727MEDICAL233333333333333333
34NAME 2828MEDICAL33333331
35NAME 2929MEDICAL23333333333331
36
37
38
39RESULT
40#DATE ARRIVE
41116-08-22
42217-08-22
43301-08-22
444
455
466
477
488
49917-08-22
501010-08-22
5111
521215-08-22
531303-08-22
5414
5515
561610-08-22
571717-08-22
581803-08-22
591903-08-22
602003-08-22
612117-08-22
622203-08-22
632310-08-22
642403-08-22
652517-08-22
6626
672703-08-22
6828
692903-08-22
Sheet1
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
How about in C41 dragged down
Excel Formula:
=IFNA(INDEX($D$6:$AH$6,XMATCH(2,INDEX($D$7:$AH$35,B41,),0,-1)),"")
 
Upvote 0
How about in C41 dragged down
Excel Formula:
=IFNA(INDEX($D$6:$AH$6,XMATCH(2,INDEX($D$7:$AH$35,B41,),0,-1)),"")
thank you fluff for the immediate reply.. it's almost ok, can we add the "#" column as additional criteria range for the lookup?..thanks
 

Attachments

  • image_2022-08-20_163447925.png
    image_2022-08-20_163447925.png
    30.3 KB · Views: 6
Upvote 0
As the numbers are effectively row numbers, it's already doing that.
 
Upvote 0
But the numbers consecutive & in order as shown on you sample?
 
Upvote 0
Try
Excel Formula:
=IFNA(INDEX($D$6:$AH$6,XMATCH(2,INDEX($D$7:$AH$35,MATCH(B41,$B$7:$B$35,0),),0,-1)),"")
 
Upvote 0
Solution
Here is an alternative solution using Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"NAME", "#", "DEPT"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] = 2)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Attribute", type date}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Attribute", "Arrival"}})
in
    #"Renamed Columns"

NAME#DEPTArrival
NAME 11HR8/16/2022
NAME 22HR8/17/2022
NAME 33HR8/1/2022
NAME 99ADMIN8/17/2022
NAME 1010OPERATIONS8/10/2022
NAME 1212OPERATIONS8/15/2022
NAME 1313OPERATIONS8/3/2022
NAME 1616ACCTG8/10/2022
NAME 1717ACCTG8/17/2022
NAME 1818ACCTG8/3/2022
NAME 1919ACCTG8/3/2022
NAME 2020ACCTG8/3/2022
NAME 2121ACCTG8/17/2022
NAME 2222WHSE8/3/2022
NAME 2323WHSE8/10/2022
NAME 2424WHSE8/3/2022
NAME 2525WHSE8/17/2022
NAME 2727MEDICAL8/3/2022
NAME 2929MEDICAL8/3/2022
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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