Subscribe Bookmark RSS Feed

Populate new column based on values of another column

twaintwist

Community Trekker

Joined:

Jun 14, 2012

I'd like to do something like an Excel VLOOKUP  ----   where I'd like to populate an empty new column (New_Status) with values from the original column (STATUS) ---  but some of the values need to be translated....   many of the original status entries do not state explicitly that the item is 'Open' but for my purposes they are open.... so I'd like a column that consolidates all the text that means 'open' to the word 'open...

Original Column:                                                                                       Translate to this new Column: 

                                              

STATUSNew_Status
ClosedClosed
Pending Group DiscussionOpen
OpenOpen
OpenOpen
Closed   ---->   Translate to this column  --->Closed
RejectedRejected
OpenOpen
OpenOpen
Ready to Deploy to QAOpen
Ready to Deploy to QAOpen
Ready to Deploy to QAOpen
QA Testing In Progress (on QA Platform)Open
OpenOpen
ResolvedResolved
OpenOpen
Ready to Deploy to QAOpen
OpenOpen
Ready to Deploy to QAOpen
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

You can create a column formula for this.  You'll have to keep it up to date with valid Open values.  Assuming that dt points to your table:

dt << New Column( "New Status Formula", Character, Nominal,

    Formula(If (:STATUS == "Open" |

                :STATUS == "Pending Group Discussion" |

                :STATUS == "Ready to Deploy to QA" |

                :STATUS == "QA Testing In Progress (on QA Platform)",

            // then

                "Open",

            // else

                :STATUS

            )

    )

);

3 REPLIES
Solution

You can create a column formula for this.  You'll have to keep it up to date with valid Open values.  Assuming that dt points to your table:

dt << New Column( "New Status Formula", Character, Nominal,

    Formula(If (:STATUS == "Open" |

                :STATUS == "Pending Group Discussion" |

                :STATUS == "Ready to Deploy to QA" |

                :STATUS == "QA Testing In Progress (on QA Platform)",

            // then

                "Open",

            // else

                :STATUS

            )

    )

);

ms

Super User

Joined:

Jun 23, 2011

An alternative to If() is the Match() function that may be easier to maintain if the non-open statuses are static and few

The formula below returns "Open" for all except for "Closed",  "Rejected" and   "Resolved".

Match( :STATUS,

  "Closed", "Closed",

  "Rejected", "Rejected",

  "Resolved", "Resolved",

  "Open"

)

twaintwist

Community Trekker

Joined:

Jun 14, 2012

PM --- THANK YOU -----     for your quick response and it works perfectly ------