• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Indentation to proper format (refer to the sample attached)

Ravi Dawar

New Member
Hi,

I am working on a transformation project and I have received a file with rules. Those rules contain logical operators but are written with an indentation style. e.g. one rule is like -

AND
AND
OR
(marketing source code) is (dtvDws)
(marketing source code) is (leaseMDU)
OR
AND
(collect payment flag) is (true)
(mfh wiring code) is (W2D)
(collect payment flag) is (false) or property is null
OR
(account status) is (ACTV)
(customer status) is (existing)

As you can see the operators are indented such that this rule will translate to -

{
[ (marketing source code) is (dtvDws) or (marketing source code) is (leaseMDU) ]
And
{
[ ( collect payment flag) is (true) and (mfh wiring code) is (W2D) ] or [ (collect payment flag) is (false) or property is null ]
}
}
And
{
[ (account status) is (ACTV) OR (customer status) is (existing) ]
}

I did this translation manually. There are 100 of such rules.

Is there a way to write a VB script or some other smart excel function which can translate this.

I am attaching the sample excel which contains the input and the desired output.

Appreciate your help,
Ravi.
 

Attachments

  • Chandoo_Sample.xlsx
    8.4 KB · Views: 2
After posting, I realize that the indentation doesn't come right way in this post. Please refer to the excel for the correct display.
 
Back
Top