Search code examples
excelexcel-formuladuplicatestextjoinexcel-tables

TEXTJOIN no duplicates no blanks, table, seperate columns


I have this table: enter image description here

on Cell A4 i want the value "Orange". I want to take only the summary of the three Fruit columns marked in orange:

  • table format (so instead of cells B2,E2,H2 I need [@Fruit 1], [@Fruit 2], [@Fruit 3])
  • only the fruit columns which are separated by irrelevant price and weight columns between them.
  • no duplicates (so Fruit 1: Apple & Fruit 2: Apple 2 becomes just "Apple" and not "Apple,Apple")
  • no blanks (so Row 4 will be "Orange" and not "Orange,")

any help will be greatly appreciated.


Solution

  • You were right to include the textjoin tag because that's what you're going to need to use. Something like this:
    =TEXTJOIN(", ", TRUE, [@Fruit 1], IF([@Fruit 1] = [@Fruit 2], "", [@Fruit 2]), IF(OR([@Fruit 1] = [@Fruit 3], [@Fruit 2] = [@Fruit 3]), "", [@Fruit 3])).

    That second parameter in the Textjoin formula sets it to ignore empty values. The IF formulas return empty values if their value has shown in a previous column (that is, Fruit 2 checks Fruit 1, Fruit 3 checks both Fruit 1 and 2 columns).