Oct 12 2020 02:52 PM - edited Oct 13 2020 02:25 PM
I'm a beginning Excel user. Still learning terms. I want to copy row data that matches specific column data.
The column data I want to match on is composed of Sales Contact names. The Sales contact names rarely change. The column header never changes, it's AK. I'm building a macro to copy data rows matching ONLY those Contact names I've listed in column AK.
I'm familiar with building macros, but having trouble determining which Function(s) might best perform this job.
XLookup seems to be the best candidate. But Microsoft's examples don't fit the bill.
Do I need to create a lookup_array? Can anyone point me in direction with great Xlookup examples?
(If Xlookup is the way to go) Thank you,
I've provided sample data:
The names in column AK will change from day to day but the list of names is limited to 10 different known names. I've included an example list below. The function should be aware of this list.
I'll copy only the row data matching anyone in that list of 10 names.
In this example, I'd only want Annie MacDonald and Sam Jones.
I want to copy these rows to another worksheet.
My list of 10 names:
Sam Jones
Annie MacDonald
Lucy Brown
Tom Fitter
Walt White
Sally Mcgee
Tonia Arnold
Lou Reed
Sammy Hagar
Warren Zevon
Oct 13 2020 01:24 AM
Since you have not shares any sample data as well as expected output, therefore I've assumed the data set along with the criteria, and would like to show few method, that how could you extract record/records.
How it works:
Method 1:
{=IFERROR(INDEX($A$12:$D$21,SMALL(IF(COUNTIF($G$10,$C$12:$C$21),ROW($A$12:$D$21)-MIN(ROW($A$12:$D$21))+1),ROW(A1)),COLUMN(A1)),"")}
Method 2:
=VLOOKUP($G$18,$A$12:$D$21,COLUMN(A1),FALSE)
Method 3:
=VLOOKUP($G$24,CHOOSE({1,2},$C$12:$C$21,A12:A21),2,0)
N.B. Adjust cell references and criteria in formula as needed.
Oct 13 2020 02:28 PM
Oct 14 2020 05:08 AM - edited Oct 14 2020 05:24 AM
You need Method 1, with little modifications.
Use this array (CSE) formula where you need, finish with Ctrl+Shift+Enter, and fill across.
{=IFERROR(INDEX($D$4:$AK$13,SMALL(IF(COUNTIF($AK$1,$AK$4:$AK$13)+COUNTIF($AK$2,$AK$4:$AK$13),ROW($D$4:$AK$13)-MIN(ROW($D$4:$AK$13))+1),ROW(A1)),COLUMN(A1)),"")}
N.B.
Oct 14 2020 07:14 AM
@jazmarc You may want to use a pivot table for this and filter by the names you are interested in. You could even add a slicer to easily select those names.
Alternatively, if you have the up to date Excel with dynamic arrays you should have a function called FILTER() which can make this process relatively easier if you have something against pivot tables. Basically you can use:
=FILTER(A:A,ISNUMBER(MATCH($AO:$AO,$CC:$CC)))
where I have the names listed in column CC (you could change that to a different column, different sheet, or defined name)
and then copy that right for however many columns you need.
Oct 14 2020 07:27 AM
Oct 21 2020 02:05 PM
@mtarler I'm still working with your FILTER idea. Tried pivot table too. I keep coming back to how do I
setup the FILTER to be aware of the 10 names that do not change but may appear in today's daily report?
Here's a very small subset of my data. Names were changed. I'm trying to copy the rows that match certain names in column E to another spreadsheet (DailyRptB.xlsx). I'm really only concerned with matching on names, not numbers. For simplicity sake say Terri cooper, Barbara, Connie, JC Frank names are the rows I want to MATCH and FILTER on. Whatever FILTER criteria I use, tomorrow the column values may not have Terri, Barbra etc. but have Yuri, Tiffany, Marc (who also comprise my unique group of Sales people).
SO my Filter should incorporate those names too in case they show up during the week.
Will my Filter function look like this?
=FILTER(A:A,ISNUMBER(MATCH($E:$E="Terri Cooper","Barbara","Connie","JC Frank","Yuri","Tiffany","Marc"$B:$G)))
Then how does the copy to another spreadsheet work?
Oct 21 2020 03:23 PM
@jazmarc I have typed your example table in and created and example in the attached.
Jun 11 2021 03:31 AM
Jun 11 2021 05:00 AM
Jun 11 2021 05:11 AM