Sometimes you need to turn a number into a word, for example instead of 7
you want to use the word seven
.
There are several ways to do this, in and in this guide, I show you some easy ways to do it.
Letโs dive in ๐ค
Method #1: switch function
The easiest method is by replacing numbers with one of the general functions.
With the switch() function, we can go through a list of options and return the first match.
So we could give a list of possible numbers, with the equivalent word for that number.
Hereโs a simplified example with only numbers from 1 to 5, where the your_number
item has the value 3
.
switch(your_number;1;one;2;two;3;three;4;four;5;five)
= three
See what happened?
The your_number
value has the value 3
, and then it found the first match in the list and returned the value three
next to it.
And you can do this too with numbers from 1 to 100:
switch(your_number;1;one;2;two;3;three;4;four;5;five;6;six;7;seven;8;eight;9;nine;10;ten;11;eleven;12;twelve;13;thirteen;14;fourteen;15;fifteen;16;sixteen;17;seventeen;18;eighteen;19;nineteen;20;twenty;21;twenty-one;22;twenty-two;23;twenty-three;24;twenty-four;25;twenty-five;26;twenty-six;27;twenty-seven;28;twenty-eight;29;twenty-nine;30;thirty;31;thirty-one;32;thirty-two;33;thirty-three;34;thirty-four;35;thirty-five;36;thirty-six;37;thirty-seven;38;thirty-eight;39;thirty-nine;40;forty;41;forty-one;42;forty-two;43;forty-three;44;forty-four;45;forty-five;46;forty-six;47;forty-seven;48;forty-eight;49;forty-nine;50;fifty;51;fifty-one;52;fifty-two;53;fifty-three;54;fifty-four;55;fifty-five;56;fifty-six;57;fifty-seven;58;fifty-eight;59;fifty-nine;60;sixty;61;sixty-one;62;sixty-two;63;sixty-three;64;sixty-four;65;sixty-five;66;sixty-six;67;sixty-seven;68;sixty-eight;69;sixty-nine;70;seventy;71;seventy-one;72;seventy-two;73;seventy-three;74;seventy-four;75;seventy-five;76;seventy-six;77;seventy-seven;78;seventy-eight;79;seventy-nine;80;eighty;81;eighty-one;82;eighty-two;83;eighty-three;84;eighty-four;85;eighty-five;86;eighty-six;87;eighty-seven;88;eighty-eight;89;eighty-nine;90;ninety;91;ninety-one;92;ninety-two;93;ninety-three;94;ninety-four;95;ninety-five;96;ninety-six;97;ninety-seven;98;ninety-eight;99;ninety-nine;100;one hundred)
= sixty-four
Copy and paste this into a field in Make.com to get the formula above:
{{switch(1.your_number; 1; "one"; 2; "two"; 3; "three"; 4; "four"; 5; "five"; 6; "six"; 7; "seven"; 8; "eight"; 9; "nine"; 10; "ten"; 11; "eleven"; 12; "twelve"; 13; "thirteen"; 14; "fourteen"; 15; "fifteen"; 16; "sixteen"; 17; "seventeen"; 18; "eighteen"; 19; "nineteen"; 20; "twenty"; 21; "twenty-one"; 22; "twenty-two"; 23; "twenty-three"; 24; "twenty-four"; 25; "twenty-five"; 26; "twenty-six"; 27; "twenty-seven"; 28; "twenty-eight"; 29; "twenty-nine"; 30; "thirty"; 31; "thirty-one"; 32; "thirty-two"; 33; "thirty-three"; 34; "thirty-four"; 35; "thirty-five"; 36; "thirty-six"; 37; "thirty-seven"; 38; "thirty-eight"; 39; "thirty-nine"; 40; "forty"; 41; "forty-one"; 42; "forty-two"; 43; "forty-three"; 44; "forty-four"; 45; "forty-five"; 46; "forty-six"; 47; "forty-seven"; 48; "forty-eight"; 49; "forty-nine"; 50; "fifty"; 51; "fifty-one"; 52; "fifty-two"; 53; "fifty-three"; 54; "fifty-four"; 55; "fifty-five"; 56; "fifty-six"; 57; "fifty-seven"; 58; "fifty-eight"; 59; "fifty-nine"; 60; "sixty"; 61; "sixty-one"; 62; "sixty-two"; 63; "sixty-three"; 64; "sixty-four"; 65; "sixty-five"; 66; "sixty-six"; 67; "sixty-seven"; 68; "sixty-eight"; 69; "sixty-nine"; 70; "seventy"; 71; "seventy-one"; 72; "seventy-two"; 73; "seventy-three"; 74; "seventy-four"; 75; "seventy-five"; 76; "seventy-six"; 77; "seventy-seven"; 78; "seventy-eight"; 79; "seventy-nine"; 80; "eighty"; 81; "eighty-one"; 82; "eighty-two"; 83; "eighty-three"; 84; "eighty-four"; 85; "eighty-five"; 86; "eighty-six"; 87; "eighty-seven"; 88; "eighty-eight"; 89; "eighty-nine"; 90; "ninety"; 91; "ninety-one"; 92; "ninety-two"; 93; "ninety-three"; 94; "ninety-four"; 95; "ninety-five"; 96; "ninety-six"; 97; "ninety-seven"; 98; "ninety-eight"; 99; "ninety-nine"; 100; "one hundred"; "unknown")}}
Whatever number you throw into it from 1 to 100, it will now return the word equivalent.
As you can see, the formula gets long, but Make.com can handle this no problem.
But it gets difficult if it gets any longer, if you maybe have hundreds or even thousands of possible numbers, and maybe with decimals.
In that case, you need to use one of the other solutions below.
Method #2: use OpenAI
This is especially an easy method if you already use the OpenAI module in any of your other scenarios.
(not using OpenAI yet? Follow this tutorial first to learn how to connect it)
Instead of using yet another service, we can just ask OpenAI what the word equivalent of a number is.
I like to use this prompt: Convert the number {your_number} into its written word equivalent. Respond with only the word form of the number..
![use-openai-module-in-make.com-to-convert-number-to-a-word use openai module in make.com to convert number to a word](https://automatewithmax.com/wp-content/uploads/2024/12/use-openai-module-in-make.com-to-convert-number-to-a-word.jpeg)
Import: want this scenario? Import this blueprint to Make.com ๐
Then, make sure to toggle Show advanced settings and set it like this:
- Response format: text
- Max completion tokens: 500
- Temperature: 0
Everything else you can leave as is, but this will ensure that OpenAI isnโt going to get too creative and stick to facts, haha.
So in this test run, you see that the first module contained the number 64 and it returned sixty-four:
![result-of-openai-module-after-converting-number-to-a-word result of openai module after converting number to a word](https://automatewithmax.com/wp-content/uploads/2024/12/result-of-openai-module-after-converting-number-to-a-word.jpeg)
You can then use the result of that module in another module ๐
![map-result-of-openai-module-in-another-module-with-the-converted-number map result of openai module in another module with the converted number](https://automatewithmax.com/wp-content/uploads/2024/12/map-result-of-openai-module-in-another-module-with-the-converted-number.jpeg)
And you can use this for any number, even really long ones:
849372556035298634065345.1312
= Eight hundred forty-nine septillion three hundred seventy-two sextillion five hundred fifty-six quintillion thirty-five quadrillion two hundred ninety-eight trillion six hundred thirty-four billion sixty-five million three hundred forty-five and one thousand three hundred twelve ten-thousandths
The cost of this conversion is incredibly lowโthis complex example costs just $0.00087. Itโs hardly worth worrying about and is far more cost-effective than subscribing to a dedicated numbers-to-words API.
Method #3: custom script
This is only useful if you have access to the FTP of you website where you can upload files.
But Iโve made a simple script for you, that you can just upload, and can then use in Make.com.
Create a file called number-to-text.php
and add this code:
<?php
// Allow cross-origin requests
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");
function numberToWords($number) {
$f = new NumberFormatter("en", NumberFormatter::SPELLOUT);
return $f->format($number);
}
// Check if 'number' is passed in the URL
if (isset($_GET['number'])) {
$number = $_GET['number'];
// Validate the number input
if (is_numeric($number)) {
$word = numberToWords($number);
echo json_encode(["number" => $number, "text" => $word]);
} else {
echo json_encode(["error" => "Invalid number. Please provide a valid numeric value."]);
}
} else {
echo json_encode(["error" => "No number provided. Use the 'number' parameter in the URL."]);
}
?>
Then, in your scenario, add a HTTP
module with the Make a request
action:
![add-http-make-a-request-module-to-make-com-scenario add http make a request module to make com scenario](https://automatewithmax.com/wp-content/uploads/2024/12/add-http-make-a-request-module-to-make-com-scenario.jpeg)
After thatโs done, you can add the URL to your script with ?number=
as a parameter.
https://example.com/number-to-text.php?number=your_number
And make sure to set Parse response
to Yes
.
![add-url-number-to-word-script-to-field-in-http-module-in-make-com add url number to word script to field in http module in make com](https://automatewithmax.com/wp-content/uploads/2024/12/add-url-number-to-word-script-to-field-in-http-module-in-make-com.jpeg)
And now, when the scenario runs, it will give you the text of the numbers ๐
![output-data-number-to-word-script-make-com output data number to word script make com](https://automatewithmax.com/wp-content/uploads/2024/12/output-data-number-to-word-script-make-com.jpeg)
And you can then easily map that into any other module or filter.
Conclusion
Need a simple conversion, like converting someones age to the word equavalent, then use the built-in switch() function.
For more complex numbers, or numbers with decimals, use the OpenAI module or the custom script.
Happy automating! ๐
Why would anyone use such a long switch function when there are simpler methods? Isnโt this overly complicated? Also, what about numbers beyond 100? Seems impractical.
Yes, I agree that itโs not a pretty function, but I like it because you donโt need any external tools.
For numbers beyond 100, the other methods in this article are better ๐
This is quite interesting! I didnโt know Make.com could handle number-to-word conversions so easily. The switch function looks simple but effective. I wonder though, does it work with larger numbers or decimals? Would love to see more examples on that!
Hey Samual! For large numbers or numbers with decimals, you can use the custom script I provided or use the OpenAI module.