Forum Discussion

rafterse's avatar
rafterse
Helper I
2 years ago
Solved

Power Query create a new column in power query based on inputs from 3 columns

i want to return a value based on the value on two columns and the first 5 characters of a 3rd column 

Column A Column BColumn CNew Column
1Ted

Red light

Yes
2Ted Red DarkNo
1TedRed DarkYes

 

eg i want a "Yes" in New column if A=1, B="Ted" and C starts with "Red"

 

thanks 

  • Hi rafterse,

     

    Add a New column with this code:

    = if [Column A] = 1 and [Column B] = "Ted" and Text.Start([Column C], 3) = "Red" then "Yes" else "No"

     

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi rafterse ,

     

    I tested the program _AAndrade  offers and it gives you the results you want perfectly.  If reply solved your problem, please mark it as the correct solution, and point out if the problem persists.

     

    Best Regards,
    Adamk Kong

6 Replies

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    Hi rafterse,

     

    Add a New column with this code:

    = if [Column A] = 1 and [Column B] = "Ted" and Text.Start([Column C], 3) = "Red" then "Yes" else "No"

     

  • Hii rafterse 

    In power query please add a custom column and write this 
    = if [Column A] = 1 and [Column B] = "Ted" and Text.Start([Column C], 3) = "Red" then "Yes" else "No"

    If this helps you please give thumbs up and accept it as solution

    Thank you!!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rafterse ,

     

    I tested the program _AAndrade  offers and it gives you the results you want perfectly.  If reply solved your problem, please mark it as the correct solution, and point out if the problem persists.

     

    Best Regards,
    Adamk Kong