Need unique rows displayed based on car no. selected through a drop-down menu

Miloni

Board Regular
Joined
Nov 10, 2008
Messages
103
Office Version
  1. 2007
Platform
  1. Windows
Car No.Date of EntryDriver NameTrip Start DateTrip End DateTrip No. of Days
1234​
01-08-2020​
abc
03-05-2020​
12-05-2020​
9​
4567​
02-02-2020​
jkl
05-02-2020​
09-02-2020​
4​
2589​
03-02-2020​
hijhk
03-02-2020​
07-02-2020​
4​
2358​
04-02-2020​
srdtfyj
07-02-2020​
09-02-2020​
2​
1234​
05-02-2020​
abc
09-02-2020​
17-02-2020​
8​
4567​
02-02-2020​
jkl
05-02-2020​
09-02-2020​
4​
8512​
03-02-2020​
hijhk
03-02-2020​
07-02-2020​
4​
1234​
04-02-2020​
srdtfyj
07-02-2020​
09-02-2020​
2​

If the Car No. selected is "1234"; the expected result in a different sheet should be as follows :

Date of Entry Driver Name
01-08-2020 Abc
05-02-2020 abc
04-02-2020 srdtfyj

I tried using vlookup, which is giving me the 1st result of date of entry 01-08-2020 and driver name abc.

Is it possible to get all the results displayed whose car no. is 1234 ?

Any help appreciated.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi Miloni,

As long as the Car No. is numeric then this should work.
NOTE: You should update your profile with your Excel version as this Excel 2016 approach has simpler solutions in later versions.

Here's Sheet1 with your data and the built LoV.

Miloni.xlsx
ABCDEFGHI
1Car No.Date of EntryDriver NameTrip Start DateTrip End DateTrip No. of Days0
2123401-Aug-20abc03-May-2012-May-2091234
3456702-Feb-20jkl05-Feb-2009-Feb-2042358
4258903-Feb-20hijhk03-Feb-2007-Feb-2042589
5235804-Feb-20srdtfyj07-Feb-2009-Feb-2024567
6123405-Feb-20abc09-Feb-2017-Feb-2088512
7456702-Feb-20jkl05-Feb-2009-Feb-204 
8851203-Feb-20hijhk03-Feb-2007-Feb-204 
9123404-Feb-20srdtfyj07-Feb-2009-Feb-202 
10
Sheet1
Cell Formulas
RangeFormula
I2:I9I2=IFERROR(AGGREGATE(15,6,$A$2:$A$9999/($A$2:$A$9999>I1),1),"")


Here's Sheet2 with the Car No. selection and list of matches.

Miloni.xlsx
ABC
1SelectDate of EntryDriver Name
2123401-Aug-20abc
305-Feb-20abc
404-Feb-20srdtfyj
5  
6  
7  
8  
Sheet2
Cell Formulas
RangeFormula
B2:C8B2=IFERROR(INDEX(Sheet1!B$2:B$9999,AGGREGATE(15,6,ROW(Sheet1!$A$2:$A$9999)-ROW(Sheet1!$A$1)/(Sheet1!$A$2:$A$9999=Sheet2!$A$2),ROW()-ROW(Sheet2!$B$1))),"")
Cells with Data Validation
CellAllowCriteria
A2List=OFFSET(Sheet1!$I$2,,,COUNTIF(Sheet1!$I$2:$I$9999,">0"))
 
Upvote 0
Thank you so much for your reply.

My Excel version is 2007. It does not support the Aggregate function. Is there any other way around getting the result I am looking for ?
 
Upvote 0
OK, try this:

Miloni2.xlsx
ABCDEFGHI
1Car No.Date of EntryDriver NameTrip Start DateTrip End DateTrip No. of Days0
2123401-Aug-20abc03-May-2012-May-2091234
3456702-Feb-20jkl05-Feb-2009-Feb-2048512
4258903-Feb-20hijhk03-Feb-2007-Feb-2044567
5235804-Feb-20srdtfyj07-Feb-2009-Feb-2022358
6123405-Feb-20abc09-Feb-2017-Feb-2082589
7456702-Feb-20jkl05-Feb-2009-Feb-204 
8851203-Feb-20hijhk03-Feb-2007-Feb-204 
9123404-Feb-20srdtfyj07-Feb-2009-Feb-202 
10
Sheet1
Cell Formulas
RangeFormula
I2:I9I2=IFERROR(LOOKUP(2,1/(COUNTIF($I$1:$I1,$A$2:$A$9999)=0),$A$2:$A$9999),"")


...and this

Miloni2.xlsx
ABC
1SelectDate of EntryDriver Name
2123401-Aug-20abc
305-Feb-20abc
404-Feb-20srdtfyj
5  
Sheet2
Cell Formulas
RangeFormula
B2:C5B2=IFERROR(INDEX(Sheet1!B$2:B$9999,SMALL(IF(Sheet1!$A$2:$A$9999=$A$2,ROW(Sheet1!$B$2:$B$9999)-MIN(ROW(Sheet1!$B$2:$B$9999))+1),ROW()-ROW($K$1))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Data Validation
CellAllowCriteria
A2List=OFFSET(Sheet1!$I$2,,,COUNTIF(Sheet1!$I$2:$I$9999,">0"))
 
Upvote 0
I2:I9I2=IFERROR(LOOKUP(2,1/(COUNTIF($I$1:$I1,$A$2:$A$9999)=0),$A$2:$A$9999),"")
What I understood is that the above formula is helping us to get a list of unique values from Column A (Car No.). Is that correct ?
I have already created a drop-down menu list for the unique car numbers, so I guess this will not be needed. Please correct me if I am wrong.
=IFERROR(INDEX(Sheet1!B$2:B$9999,SMALL(IF(Sheet1!$A$2:$A$9999=$A$2,ROW(Sheet1!$B$2:$B$9999)-MIN(ROW(Sheet1!$B$2:$B$9999))+1),ROW()-ROW($K$1))),"")
Can you please explain me the concept behind this formula and also what is the use of $K$1 ?
I tried using this formula in my sheet and I am getting a blank cell. No error, no result. I pressed Ctrl + Shift + Enter as well.

Thank you so much.
 
Upvote 0
What I understood is that the above formula is helping us to get a list of unique values from Column A (Car No.). Is that correct ?
I have already created a drop-down menu list for the unique car numbers, so I guess this will not be needed. Please correct me if I am wrong.
That is correct so not needed.

Can you please explain me the concept behind this formula and also what is the use of $K$1 ?
I tried using this formula in my sheet and I am getting a blank cell. No error, no result. I pressed Ctrl + Shift + Enter as well.

Thank you so much.
SMALL returns the kth occurrence. The IF is checking if the Car No. matches the selected Car No. and if it does it returns the ROW number to the INDEX.
The $K$1 is giving the kth value to the SMALL, so in B2 the ROW()-ROW($K$1) gives a 1 so SMALL returns the 1st row matching the IF. In B3 the ROW()-ROW($K$1) is 3-1=2 so the SMALL returns the 2nd occurrence, etc.
 
Upvote 0
Thank you so much for the detailed explanation. But still the formula is giving me a blank result. No error no result. What could be the reason ?
 
Upvote 0
Probably an incorrect cell address but without seeing your sheet then I can't really say.

Here's the Sheet2 with the selection and results moved to see if that prompts something for you.

Miloni2.xlsx
ABCDEF
1
2
3SelectDate of EntryDriver Name
4123401-Aug-20abc
505-Feb-20abc
604-Feb-20srdtfyj
7  
8  
Sheet2
Cell Formulas
RangeFormula
E4:E8E4=IFERROR(INDEX(Sheet1!B$2:B$9999,SMALL(IF(Sheet1!$A$2:$A$9999=$D$4,ROW(Sheet1!$B$2:$B$9999)-1),ROW()-ROW($E$3))),"")
F4:F8F4=IFERROR(INDEX(Sheet1!C$2:C$9999,SMALL(IF(Sheet1!$A$2:$A$9999=$D$4,ROW(Sheet1!$B$2:$B$9999)-MIN(ROW(Sheet1!$B$2:$B$9999))+1),ROW()-ROW($F$3))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Data Validation
CellAllowCriteria
D4List=OFFSET(Sheet1!$I$2,,,COUNTIF(Sheet1!$I$2:$I$9999,">0"))
 
Upvote 0
Thank you so much. It still isn't working. The data is all dummy.
1627100763514.png



1627100846506.png


1627100867360.png


All my data will be in Driver and Trip Data sheet.
Driver Bhattu and Trip report will give me a report based on the car no chosen from the drop down menu
Cell with Green background has the formula you gave me and it's returning blank to me.

Hope this helps you in guiding me.

Thank you so much
 
Upvote 0
So is B23 the first cell you expect to see data returned? Then the row counter should point at the heading in B22.

Miloni2-2.xlsx
ABCDEF
1Select
21234
3
20
21
22Date of EntryDriver NameTrip Start DateTrip End DateTrip No. of Days
2301-Aug-20abc03-May-2012-May-209
2405-Feb-20abc09-Feb-2017-Feb-208
2504-Feb-20srdtfyj07-Feb-2009-Feb-202
26     
Driver Bhatu and Trip Report
Cell Formulas
RangeFormula
B23:F26B23=IFERROR(INDEX('Driver and Trip Data'!B$2:B$9999,SMALL(IF('Driver and Trip Data'!$A$2:$A$9999=$A$2,ROW('Driver and Trip Data'!$B$2:$B$9999)-MIN(ROW('Driver and Trip Data'!$B$2:$B$9999))+1),ROW()-ROW(B$22))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Data Validation
CellAllowCriteria
A2List=OFFSET('Driver and Trip Data'!$I$2,,,COUNTIF('Driver and Trip Data'!$I$2:$I$9999,">0"))
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

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