Forum Discussion

KathyBenjamin's avatar
KathyBenjamin
Qrew Trainee
3 years ago

Formula help to trim my numbers seperated by a comma

Hi,

I have a field [Control Number] that has multiple controls listed and separated by a comma.  I'm looking for a formula that will capture the control number without the comma.

Ex
[Control Number] = [187461, 187462, 187463, 187464, 187465, 187466]

I need to break out by the following into 6 different fields:
[Control 1] = 187461
[Control 2] = 187462
[Control 3] = 187463
[Control 4] = 187464
[Control 5] = 187465
[Control 6] = 187466

Any ideas? Thank you in advance!

------------------------------
Kathy Benjamin
------------------------------
  • I think you need to change the separator before replacing the commas.

    First replace the Comma+Space with a semicolon. Then replace the commas.

    Try this for Control1:

    var text ControlTemp = SearchAndReplace([Control],", ",";");
    var text ControlNew = SearchAndReplace($ControlTemp,",","");
    Part($ControlNew, 1, ";")



    ------------------------------
    Tammie King
    ------------------------------
    • KathyBenjamin's avatar
      KathyBenjamin
      Qrew Trainee
      Thank you.  That worked awesome.

      ------------------------------
      Kathy Benjamin
      ------------------------------
    • KathyBenjamin's avatar
      KathyBenjamin
      Qrew Trainee
      Is it possible to add to the formula to remove the zero when it is present?
      0176771, 0176772, 0835409 
      example

      ------------------------------
      Kathy Benjamin
      ------------------------------
      • PrashantMaheshw's avatar
        PrashantMaheshw
        Qrew Captain
        You can check the condition with Left and then notleft

        if(left(Part($ControlNew, 1, ";"),1)="0",NotLeft(Part($ControlNew, 1, ";"),1),Part($ControlNew, 1, ";"))




        ------------------------------
        Prashant Maheshwari
        ------------------------------
  • There is a searchandreplace formula which should be relevant for you

    SearchandReplace([Control Number],",","")

    ------------------------------
    Prashant Maheshwari
    ------------------------------
    • KathyBenjamin's avatar
      KathyBenjamin
      Qrew Trainee
      Thank you, I'll check it out.

      ------------------------------
      Kathy Benjamin
      ------------------------------