Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

if formula based on string values in text

Hi Experts

 

I have a column in Table that has string values thats start with either complaints and sales as follows:

1. complaints_text_ and

2. sales.csv 

 

Formula to go into new column

1. if the string start complaints_ replace the value as Complaints

2. if the strinf starts sales.csv replace the value as Sales

and all other strings in column A remain as is.

 

  • So perhaps:
    Column1 =
    SWITCH(TRUE()
    "complaints_" IN { 'Table'[Column] }, SUBSTITUTE('Table'[Column],"complaints_","Complaints "),
    "sales.csv" IN { 'Table'[Column] }, SUBSTITUTE('Table'[Column],"sales.csv","Sales ")
    )

4 Replies