List records

alliswell

Board Regular
Joined
Mar 16, 2020
Messages
190
Office Version
  1. 2007
Platform
  1. Windows
  2. Mobile
Hi everybody !
I am using excel 2007.
In column A i have client names and in column B are dates and in column M are totals in sheet2.

Now in sheet 1, in column A1 When i input name "John Parker" in A1 then i must get all records of John Parker with dates and totals in sheet1 A3,B3,C3
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Is that what you mean?

Book1
ABC
1John
2
3John6/29/2023100
Sheet1
Cell Formulas
RangeFormula
A3A3=A1
B3B3=VLOOKUP($A3,Sheet2!$A$2:$M$5,2,0)
C3C3=VLOOKUP($A3,Sheet2!$A$2:$M$5,13,0)


NameDateTotals
John
6/29/2023​
100​
Mary
7/1/2023​
200​
Sue
7/12/2023​
250​
Bill
8/10/2023​
50​
 
Upvote 0
Is that what you mean?

Book1
ABC
1John
2
3John6/29/2023100
Sheet1
Cell Formulas
RangeFormula
A3A3=A1
B3B3=VLOOKUP($A3,Sheet2!$A$2:$M$5,2,0)
C3C3=VLOOKUP($A3,Sheet2!$A$2:$M$5,13,0)


NameDateTotals
John
6/29/2023​
100​
Mary
7/1/2023​
200​
Sue
7/12/2023​
250​
Bill
8/10/2023​
5​
Sheet2
A B M
Names Dates Total
John Parker 13/01/1978 55
Alisha Bush 21/09/2022 190
John Parker 17/03/2023 117
michael Lee 11/06/2023 553
John Parker 23/06/2023 700

Sheet1
In A1 when i type John Parker in sheet1,
I must get all records of john parker only in sheet1 from A3 to how many john records are

John Parker 13/01/1978 55
John Parker 17/03/2023 117
John Parker 23/06/2024 700

Now there were 3 records of john so it must show like above
 
Upvote 0
That's considerably different from what you initially posted.
 
Upvote 0
How about this?

Code:
Sub multilookup()
Dim lr, i, j As Long
Sheets("Sheet1").Rows("4:100").EntireRow.Delete
lr = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row
j = 4
For i = 2 To lr
 If Sheets("Sheet2").Cells(i, 1) = Sheets("Sheet1").Cells(1, 1) Then
  Sheets("Sheet1").Cells(j, 1) = Sheets("Sheet1").Cells(1, 1)
  Sheets("Sheet1").Cells(j, 2) = Sheets("Sheet2").Cells(i, 2)
  Sheets("Sheet1").Cells(j, 3) = Sheets("Sheet2").Cells(i, 13)
  j = j + 1
 End If
Next i
Sheets("Sheet1").Range("B4:B100").NumberFormat = "dd/mm/yyyy"
End Sub
 
Upvote 0
How about this?

Code:
Sub multilookup()
Dim lr, i, j As Long
Sheets("Sheet1").Rows("4:100").EntireRow.Delete
lr = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row
j = 4
For i = 2 To lr
 If Sheets("Sheet2").Cells(i, 1) = Sheets("Sheet1").Cells(1, 1) Then
  Sheets("Sheet1").Cells(j, 1) = Sheets("Sheet1").Cells(1, 1)
  Sheets("Sheet1").Cells(j, 2) = Sheets("Sheet2").Cells(i, 2)
  Sheets("Sheet1").Cells(j, 3) = Sheets("Sheet2").Cells(i, 13)
  j = j + 1
 End If
Next i
Sheets("Sheet1").Range("B4:B100").NumberFormat = "dd/mm/yyyy"
End Sub
No i dont want vba
Is it possible through formula or function ?
 
Upvote 0
This should work in 2007.
It will sort the records by ascending date.
And if you move the first row of calculations to another row you must update the Row()-9, and Row()-10 integers in all of the formlas to the correct offset number value. And you must copy the formula down as many rows as you think you have number of records for one name, at least. I would not COPY it all the way down as it may slow your system up as these are fairly complex formulas.

Best wishes.


Book1
ABCD
1
2NamesDatesTotal
3John Parker1978-01-1355
4Alisha Bush2022-09-21190
5John Parker2023-03-17117
6michael Lee2023-06-11553
7John Parker2023-06-23700
8
9John Parker
10John Parker1978-01-1355
11John Parker2023-03-17117
12John Parker2023-06-23700
13   
Sheet2
Cell Formulas
RangeFormula
A10:A13A10=IF(COUNTIF($A$3:$A$7,A9)<(ROW()-9),"",A9)
B10:B13B10=IF(COUNTIF($A$3:$A$7,A9)<(ROW()-9),"", LARGE(($A10=$A$3:$A$7)*($B$3:$B$7), COUNTIF($A$3:$A$7,$A9)-(ROW()-10)))
C10:C13C10=IF(COUNTIF($A$3:$A$7,A9)<(ROW()-9),"",INDEX($C$3:$C$7,MATCH($A10&$B10,$A$3:$A$7&$B$3:$B$7,0)))
 
Last edited:
Upvote 0
Try the formula below:
Also, take a look at ADAVANCED FILTER in the menu which may be the better way to go.

The formula in A4 is an array formula and must be entered with CTRL-SHIFT-ENTER, then drag down the rows as needed.
Formulas in B4 to D4 can be enter with just ENTER, then drag down as needed.

Sheet1
Book3
ABCD
1Name:John Parker
2# of Times3
3Ref#NameDateTotals
41John Parker1/13/7855
53John Parker3/17/23117
65John Parker6/23/23700
Sheet1
Cell Formulas
RangeFormula
B2B2=COUNTIF(Sheet2!$A$2:$A$6,$B$1)
A4:A6A4=IF(ROWS($A$4:A4)>$B$2,"",SMALL(IF($B$1=Sheet2!$A$2:$A$6,ROW(Sheet2!$A$2:$A$6)-ROW(Sheet2!$A$2)+1),ROWS($A$4:A4)))
B4:B6B4=IF($A4="","",INDEX(Sheet2!$A$2:$A$6,$A4,1))
C4:C6C4=IF($A4="","",INDEX(Sheet2!$B$2:$B$6,$A4,1))
D4:D6D4=IF($A4="","",INDEX(Sheet2!$M$2:$M$6,$A4,1))
Press CTRL+SHIFT+ENTER to enter array formulas.


Sheet2
Book3
ABCM
1NameDateTotal
2John Parker1/13/197855
3Alisha Bush9/21/2022190
4John Parker3/17/2023117
5michael Lee6/11/2023553
6John Parker6/23/2023700
Sheet2
 
Upvote 0

Forum statistics

Threads
1,215,727
Messages
6,126,512
Members
449,316
Latest member
sravya

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