Forum Discussion

HenryJS's avatar
HenryJS
Post Prodigy
6 years ago
Solved

New Column: IF, Return

Hi all,

 

I have the below data and I would like to create a new column which states:

  • IF Rate1TypeName or Rate2TypeName or Rate3TypeName = "CUK Vehicle Rent - Week"
  • THEN return the value in the field in the column next to the column that had "CUK Vehicle Rent - Week"

 

So for example it would be called "CUK Vehicle Rent - Week Pay Rate"

 

And for Candidate Ref 35452( Row 3) it would be-35 because that is the value adjacent to the type column that had "CUK Vehicle Rent - Week"

 

 

Hope that makes sense

 

 

 

Rate1TypeNameRate1PayRateRate2TypeNameRate2PayRateRate3TypeNameRate3PayRate
Hourly STD Rate15.68Bonus400  
Hourly STD Rate15.68Bonus400  
Shifts - Standard270CUK Vehicle - Hours0CUK Vehicle Rent - Week-35
Standard Rate27.5CUK Vehicle - Hours0  
Standard Rate27.5CUK Vehicle - Hours0  
Standard Rate27.5CUK Vehicle - Hours0  
Standard Rate27.5CUK Vehicle - Hours0  
Standard Day Rate28CUK Vehicle - Hours0  
Standard Rate28.5CUK Vehicle - Hours0  
Standard Day Rate28CUK Vehicle - Hours0  
Standard Day Rate28CUK Vehicle - Hours0  
Standard Day Rate28CUK Vehicle - Hours0  
Standard Rate330CUK Vehicle - Shifts0  
Standard Rate330CUK Vehicle - Shifts22  
Standard Rate330CUK Vehicle - Shifts22  
Standard Rate29CUK Vehicle Rent - Week-110  
Standard Rate29CUK Vehicle Rent - Week-110  

 

  • HenryJS  try adding a new column with the following expression

     

    New Column = 
    SWITCH ( TRUE(),
    Table[Rate3TypeName] = "CUK Vehicle Rent - Week", Table[Rate3PayRate],
    Table[Rate2TypeName] = "CUK Vehicle Rent - Week", Table[Rate2PayRate],
    Table[Rate1TypeName] = "CUK Vehicle Rent - Week", Table[Rate1PayRate]
    )
    
    

    I would 💖 Kudos 🙂 if my solution helped. ?

     

     

5 Replies

  • HenryJS can you repost the data? Headings are all mushed up and hard to understanding where everything starts and ends. 

    • HenryJS's avatar
      HenryJS
      Post Prodigy

      parry2k  everytime I repost it comes out like that? How am I able to attach the data?

      • parry2k's avatar
        parry2k
        Super User

        HenryJS may be put in an excel with expected output and share thru one drive/google drive.