Forum Discussion

RaymondSakar's avatar
RaymondSakar
Qrew Cadet
2 years ago

Formula to display one part of text field

Hello! I'm looking for help with the proper formula syntax to grab a string of numbers from a text field. The string I want will also be after the word "Code" and before the word "Order".

Code: 123456789
Order: XXXXXXXX

Thanks!

------------------------------
Raymond Sakar
------------------------------

3 Replies

  • MarkShnier__You's avatar
    MarkShnier__You
    Qrew #1 Challenger
    There is more than one way to do this, and detecting a line feed can be tricky, but try this

    Trim(Right(Left([my Code Order field], "\n"), " "))

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • RaymondSakar's avatar
      RaymondSakar
      Qrew Cadet
      Thanks, Mark. That formula output the Order #, not the Code. I've tried several variations and can't seem to get the Code.​ I either get the Order, the word "Code" or the word "Order"

      ------------------------------
      Raymond Sakar
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew #1 Challenger
        OK, Plan B

        var text ReplaceCode = SearchAndReplace([Code Order], "Code:", "|");
        var text ReplaceOrder = SearchAndReplace($ReplaceCode, "Order:", "|");

        Trim(Part($ReplaceOrder,2, "|"))

        ------------------------------
        Mark Shnier (YQC)
        mark.shnier@gmail.com
        ------------------------------