What's wrong with this function

:bullseye: What is your goal?

I’m basically trying to test if the recorded phone number starts with +61 or not - if it does, get the phone number and if it starts with zero, remove the zero and add +61 to the recorded phone number

:thinking: What is the problem & what have you tried?

Here’s the formula that I have now:
if(substring(9.data.CellPhone; 0; 3) = +61; 9.data.CellPhone; if(substring(9.data.CellPhone; 0; 1) = 0; +61 substring(9.data.CellPhone; 1)))

Are you trying to get a consistent phone number format?

If so, have you tried the Phone number (Make built-in) module?

Yeah. This module is best for your purposes.

Excellent suggestion

Welcome to the Make community!

You just need a single function:

  • replace
    replace(text; search string; replacement string)

Here’s an example of how you can use this function:

+61{{replace(211.number; "/^(0|\+61)/"; emptystring)}}
:warning: Make Input Markup:
        Copy-paste the above into the field, including start/end curly brackets for it to import as intended

e.g.:
Screenshot 2026-05-08 235200

Replace 211.number with your variable.

Module Subflow Export - paste modules into your scenario

Copy and paste this into the scenario editor to import the example modules shown in my screenshots above.

{"subflows":[{"flow":[{"id":1,"module":"util:BasicTrigger","version":1,"parameters":{"values":[{"spec":[{"name":"text","value":"0412345678"}]},{"spec":[{"name":"text","value":"+61412345678"}]}]},"mapper":{},"metadata":{"designer":{"x":-273,"y":-154},"parameters":[{"name":"values","type":"array","label":"Bundles","required":true,"spec":[{"name":"spec","label":"Items","type":"array","required":true,"spec":[{"name":"name","label":"Name","required":true,"type":"text"},{"name":"value","label":"Value","required":true,"type":"text"}]}]}]}},{"id":2,"module":"util:SetVariable2","version":1,"parameters":{},"mapper":{"name":"intl_format","scope":"roundtrip","value":"+61{{replace(1.text; \"/^(0|\\+61)/\"; emptystring)}}"},"metadata":{"designer":{"x":27,"y":-154}}}]}],"metadata":{"version":1}}
Need help❓View instructions ◀

1. Move your mouse over the line of code above.
Copy the JSON by clicking the copy button on the right-side:

2. Enter your scenario editor. Close any open panels by pressing ESC. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

3. Click on imported modules and re-save it to trigger validation. There may be some errors prompting you to re-map some variables and select connections.

Note: Did you know you can also reduce the size of blueprint exports and module subflows like the above, using my Make Blueprint Scrubber?

@samliew
P.S.: investing some effort into the tutorials in the Make Academy will save you lots of time and frustration using Make!