Forum Discussion
Silv
May 03, 2025Copper Contributor
Look up and removing duplicates
Hi, hopefully someone can help me with this, I'm fairly new to excel and can't figure out how to make this work. Thank you!
- May 05, 2025
Let's say the table is called DemoTbl.
You could use this:
=BYROW(DemoTbl[[AAL]:[LPA]],LAMBDA(each_row,TEXTJOIN(",",1,UNIQUE(each_row,1))))
SergeiBaklan
May 05, 2025Diamond Contributor
Another Power Query variant
let
Source = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
AddResult = Table.AddColumn( Source, "Result",
each Text.Combine( List.Distinct( List.Skip( Record.FieldValues(_) ) ), ", " ), type text ),
SelectColumns = Table.SelectColumns(AddResult,{"Code", "Result"})
in
SelectColumns
To play with Office Script
function main(workbook: ExcelScript.Workbook) {
const sheet = workbook.getActiveWorksheet()
const table = workbook.getTable("Tabelle1")
const result = workbook.getTable("Result")
const target = sheet.getRange("H15:I15")
const data = table.getRangeBetweenHeaderAndTotal()
if (!result) {
target.setValues(Array.of(["Code", "Result"]))
sheet.addTable( target, true).setName("Result")
} else {
const nRows = result.getRowCount()
if (nRows) { result.deleteRowsAt(0, nRows) }
}
for (let row of data.getValues()) {
let cleaned = new Set(row.splice(1).filter(x => x))
let ooutput = [row[0]].concat([...cleaned].join(", "))
result.addRow(-1, ooutput )
}
}
- SilvMay 10, 2025Copper Contributor
Thank you but I'm sorry I don't think I understand how to use this yet, I'm fairly new in excel, self taught and mostly just use formulas. :(