How to extract multiple values (exc duplicates) with two criteria

danhendo888

Board Regular
Joined
Jul 15, 2019
Messages
129
Office Version
  1. 365
Platform
  1. Windows
Book1
ABL
1VendorInvoiceReference
2100001003422167058190052331
Burnard
Cell Formulas
RangeFormula
L2L2=(INDEX(Sheet2!$L$3:$L$21835, SMALL(IF(FREQUENCY(IF(Sheet2!$K$3:$K$21835=$B2, Sheet2!$L$3:$L$21835), Sheet2!$L$3:$L$21835), ROW(Sheet2!$L$3:$L$21835)-ROW(Sheet2!$L$3)+1), COLUMNS($L2:L2))))
Press CTRL+SHIFT+ENTER to enter array formulas.


Above is what I am using currently.
Searching with one criteria; the invoice number.

Is it possible to search using two criteria? (invoice number + vendor number)
The tricky part is that there are duplicate values in column L for a given invoice.
If possible, it should look something like the below.


Book1
IKLM
1VendorInvoiceReference
2100001003422167058190052331
3100001003422167058190052331
4100001003422167058190000001
5100001003422167058190000001
6
7
8Output:
9VendorInvoiceReference
101000010034221670581900000018190052331
Sheet2
 
Last edited by a moderator:

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
I think I don't understand, where are the square brackets?

screenshot-99.png
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,491
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
M-CODE (in Portuguese...)

Code:
let
    Fonte = Excel.CurrentWorkbook(){[Name="Tabela2"]}[Content],
    #"Tipo Alterado" = Table.TransformColumnTypes(Fonte,{{"Vendor", Int64.Type}, {"Invoice", Int64.Type}, {"Reference", Int64.Type}}),
    #"Linhas Agrupadas" = Table.Group(#"Tipo Alterado", {"Vendor", "Invoice"}, {{"Contagem", each _, type table}}),
    #"Personalização Adicionada" = Table.AddColumn(#"Linhas Agrupadas", "Reference", each List.Distinct(Table.Column([Contagem],"Reference"))),
    #"Valores Extraídos" = Table.TransformColumns(#"Personalização Adicionada", {"Reference", each Text.Combine(List.Transform(_, Text.From), ", "), type text})
in
    #"Valores Extraídos"

M.
 

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,491
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
After loading to Excel i see in the Contagem column exactly this
Contagem


M.
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
M-CODE (in Portuguese...)

Code:
let
    Fonte = Excel.CurrentWorkbook(){[Name="Tabela2"]}[Content],
    #"Tipo Alterado" = Table.TransformColumnTypes(Fonte,{{"Vendor", Int64.Type}, {"Invoice", Int64.Type}, {"Reference", Int64.Type}}),
    #"Linhas Agrupadas" = Table.Group(#"Tipo Alterado", {"Vendor", "Invoice"}, {{"Contagem", each _, type table}}),
    #"Personalização Adicionada" = Table.AddColumn(#"Linhas Agrupadas", "Reference", each List.Distinct(Table.Column([Contagem],"Reference"))),
    #"Valores Extraídos" = Table.TransformColumns(#"Personalização Adicionada", {"Reference", each Text.Combine(List.Transform(_, Text.From), ", "), type text})
in
    #"Valores Extraídos"

M.

this is OK, all is the same, you can remove first Tipo Alterado

but this?
After loading to Excel i see in the Contagem column exactly this
Contagem

I really do know why column with Tables is loaded into the sheet :oops:
 
Last edited:

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,491
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows

ADVERTISEMENT

Image

Power-Query1.jpg
 

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,491
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
this is OK, all is the same, you can remove first Tipo Alterado

but this?

I really do know why column with Tables is loaded into the sheet :oops:

See image above
By the way, i'm using Excel 2010 - not sure if this matter...

M.
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499

ADVERTISEMENT

Ex2010? this is add-in PQ, maybe they stopped updating ,

could you post a picture from PQ Editor after last step (as I did in the post #21 ?
 

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,491
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Ex2010? this is add-in PQ, maybe they stopped updating ,

could you post a picture from PQ Editor after last step (as I did in the post #21 ?


Identical to yours, but after loading to Excel the column Contagem shows up

M.
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
IMHO this is an add-in and Excel version problem, maybe try reinstall add-in (hope this is not a problem of localised version)
I don't remember how it was before because I didn't use Ex2010/PQ from the years

option: if you've a friend with Excel 2016 or higher try your file there, I mean execute code, don't remove Tables column and load to the sheet then you'll see where problem is.

Edit: I just saw image so I think you'll need remove Tables column before loading to the sheet (I don't) as standard behaviour :)
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,127,155
Messages
5,623,074
Members
415,950
Latest member
Kindz

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
Top