Search for date and penultimate date and numbers

Wojciech

New Member
Joined
May 13, 2018
Messages
27
Office Version
  1. 2021
Platform
  1. Windows
Hi,
please help me write the formula. I am attaching a screenshot that shows the table and solution. The formula should be filled with the AAA or BBB (A13 and A14) and the formula should find the latest date (B13 and B14) and the number (number of kilometers) assigned to it (C13 and C14). The formula in D13,D14 finds the penultimate date and in E13 and E14 penultimate date number assigned to the dates.
 

Attachments

  • km.png
    km.png
    42 KB · Views: 7

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
I use office 2011 with office 365 features. I updated my profile information. Thank you for your attention.

ps. I tried to install XL2BB but got the message "This file type is not supported in Protected View".
 
Upvote 0
Hi,
please help me write the formula. I am attaching a screenshot that shows the table and solution. The formula should be filled with the AAA or BBB (A13 and A14) and the formula should find the latest date (B13 and B14) and the number (number of kilometers) assigned to it (C13 and C14). The formula in D13,D14 finds the penultimate date and in E13 and E14 penultimate date number assigned to the dates.
Does this work for you?

Solution for 365.

Search for date and penultimate date and numbers.xlsm
ABCDE
1NameDateKM
2AAA28/01/202319469
3AAA01/05/202319594
4AAA26/02/20239030
5AAA21/09/20238781
6BBB04/05/20238528
7BBB12/05/202319385
8BBB19/05/202314976
9BBB02/07/202311799
10
11Solution
12inquiry:LastSecond to last
13AAA28/01/20231946926/02/20239030
14BBB04/05/2023852812/05/202319385
Sheet1
Cell Formulas
RangeFormula
B13:C14B13=CHOOSEROWS(SORT(FILTER($B$2:$C$9,$A$2:$A$9=$A13)),1)
D13:E14D13=CHOOSEROWS(SORT(FILTER($B$2:$C$9,$A$2:$A$9=$A13)),2)
Dynamic array formulas.
 
Upvote 0
Thanks for that, how about
Fluff.xlsm
ABCDE
1NameDateKM
2AAA07/09/202330019
3AAA19/09/202331369
4AAA20/10/202333293
5AAA01/09/202327579
6BBB27/07/202324972
7BBB04/08/202325695
8BBB07/07/202323392
9
10
11Solution
12inquiry:LastSecond to last
13AAA20/10/20233329319/09/202331369
14BBB04/08/20232569527/07/202324972
Sheet6
Cell Formulas
RangeFormula
B13:E14B13=TOROW(TAKE(SORT(FILTER($B$2:$C$8,$A$2:$A$8=A13),1,-1),2))
Dynamic array formulas.
 
Upvote 0
I may have made a mistake in saying that I have Office 2021 with Office 365 features. It looks like I don't have the latest features available. I don't really understand why (I'm attaching a screenshot of my version). In my language version on the Microsoft website I see the correct translation of the functions for office 365, but my package does not see them.

I would like to ask you to propose a solution for Office 2021.
 

Attachments

  • problem office 2021 2.png
    problem office 2021 2.png
    20.8 KB · Views: 4
Upvote 0
Ok, how about
Fluff.xlsm
ABCDE
1NameDateKM
2AAA07/09/202330019
3AAA19/09/202331369
4AAA20/10/202333293
5AAA01/09/202327579
6BBB27/07/202324972
7BBB04/08/202325695
8BBB07/07/202323392
9
10
11Solution
12inquiry:LastSecond to last
13AAA20/10/20233329319/09/202331369
14BBB04/08/20232569527/07/202324972
Sheet6
Cell Formulas
RangeFormula
B13:E14B13=INDEX(SORT(FILTER($B$2:$C$8,$A$2:$A$8=A13),1,-1),{1,1,2,2},{1,2,1,2})
Dynamic array formulas.
 
Upvote 1
Solution
Thank you. It's work fine now. What does it mean {1,1,2,2}. The second part {1,2,1,2} I supposed it mean B and C and B and C columns.
 
Upvote 0
The {1,1,2,2} is the row element & {1,2,1,2} is the column element. So it's taking row 1 col 1, then row 1 col 2, row 2 col 1 & finally row 2 col 2
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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