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

danhendo888

Board Regular
Joined
Jul 15, 2019
Messages
167
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:
I think I don't understand, where are the square brackets?

screenshot-99.png
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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.
 
Upvote 0
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 :banghead:
 
Last edited:
Upvote 0
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 :banghead:

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

M.
 
Upvote 0
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 ?
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

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