Converting an absolute number into a range in Make (e.g., 13 → “5–25”)

Welcome to the Make community!

You can also do this with a switch module instead, which could make it easier to change the options in future.

Here’s an example.

and here are some test cases:

Module Subflow Export - paste modules into your scenario

You can copy and paste this into the scenario editor. This will import the example modules shown in my screenshots above.

{"subflows":[{"flow":[{"id":162,"module":"util:Switcher","version":1,"parameters":{},"mapper":{"input":"88","useRegExpMatch":true,"casesTable":[{"pattern":"^[1-5]$","output":"1-5"},{"pattern":"^([5-9]|1\\d|2[0-5])$","output":"5-25"},{"pattern":"^([2-4]\\d|50)$","output":"25-50"},{"pattern":"^([5-9]\\d|100)$","output":"50-100"},{"pattern":"^([1-4]\\d\\d|500)$","output":"100-500"},{"pattern":"^([5-9]\\d\\d|1000)$","output":"500-1000"},{"pattern":"^[1-9]\\d+$","output":"1000+"}],"elseOutput":"{{null}}"},"metadata":{"designer":{"x":3433,"y":-1798,"messages":[{"category":"last","severity":"warning","message":"A transformer should not be the last module in the route."}]}}}]}],"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?

Hope this helps! If you are still having trouble, please provide more details.

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