web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Converting currency am...
Power Automate
Unanswered

Converting currency amount to words

(0) ShareShare
ReportReport
Posted on by 432 Moderator

Hi,

My customer has quotes that go out with the final amount in this format: £128,422.00 ex VAT (One Hundred and Twenty-Eight Thousand Four Hundred and Twenty-Two Pounds).

I'm using Dynamics 365 Sales Professional. When the quote total amount is set or changed, I need to generate that long string in order to include it in the Word template export of the quote. I've had a look around and I can't find it.

Is it possible? Or do I need to have a difficult conversation with the customer about changing their quotes?

Thanks

Nick

BTW - I'm aware this has already been discussed, but that thread just comes up as an error when I try it. Any and all help gratefully received.

Categories:
I have the same question (0)
  • VIDIT Profile Picture
    666 on at

    Hi @nickellis74  I believe there is not direct way to do it you can check out this solution thread which has a similar requirement as yours  - Solved: Convert number to text - Power Platform Community (microsoft.com)

    Java Script Link to convert numbers to words - Converting Numbers Into Words Using JavaScript (thoughtco.com)

     

    Let me know in case of any Issues.
    If this resolves your issue please mark this post as answered and hit me a thumps up.
    Thanks and Regards,
     Vidit

  • Paulie78 Profile Picture
    8,422 Moderator on at

    Hi @nickellis74 ,

     

    I took a look at this, relatively easy to do within JavaScript which you can access via "Office Scripts". Please see this video demo here:

    https://youtu.be/41eSmox7iPk

    The code for the Office Script function is:

    function main(workbook: ExcelScript.Workbook, n: string): string {
     var string = n.toString(), units, tens, scales, start, end, chunks, chunksLen, chunk, ints, i, word, words, and = 'and';
    
     /* Remove spaces and commas */
     string = string.replace(/[, ]/g, "");
    
     /* Is number zero? */
     if (parseInt(string) === 0) {
     return 'zero';
     }
    
     /* Array of units as words */
     units = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'];
    
     /* Array of tens as words */
     tens = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
    
     /* Array of scales as words */
     scales = ['', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion', 'decillion', 'undecillion', 'duodecillion', 'tredecillion', 'quatttuor-decillion', 'quindecillion', 'sexdecillion', 'septen-decillion', 'octodecillion', 'novemdecillion', 'vigintillion', 'centillion'];
    
     /* Split user argument into 3 digit chunks from right to left */
     start = string.length;
     chunks = [];
     while (start > 0) {
     end = start;
     chunks.push(string.slice((start = Math.max(0, start - 3)), end));
     }
    
     /* Check if function has enough scale words to be able to stringify the user argument */
     chunksLen = chunks.length;
     if (chunksLen > scales.length) {
     return '';
     }
    
     /* Stringify each integer in each chunk */
     words = [];
     for (i = 0; i < chunksLen; i++) {
    
     chunk = parseInt(chunks[i]);
    
     if (chunk) {
    
     /* Split chunk into array of individual integers */
     ints = chunks[i].split('').reverse().map(parseFloat);
    
     /* If tens integer is 1, i.e. 10, then add 10 to units integer */
     if (ints[1] === 1) {
     ints[0] += 10;
     }
    
     /* Add scale word if chunk is not zero and array item exists */
     if ((word = scales[i])) {
     words.push(word);
     }
    
     /* Add unit word if array item exists */
     if ((word = units[ints[0]])) {
     words.push(word);
     }
    
     /* Add tens word if array item exists */
     if ((word = tens[ints[1]])) {
     words.push(word);
     }
    
     /* Add 'and' string after units or tens integer if: */
     if (ints[0] || ints[1]) {
    
     /* Chunk has a hundreds integer or chunk is the first of multiple chunks */
     if (ints[2] || !i && chunksLen) {
     words.push(and);
     }
    
     }
    
     /* Add hundreds word if array item exists */
     if ((word = units[ints[2]])) {
     words.push(word + ' hundred');
     }
    
     }
    
     }
    
     return words.reverse().join(' ');
    
    }

    You just need to add this script to your Office Scripts library which you can do by accessing Excel via a browser. I suggest you create an empty workbook called PowerAutomateFunctions.xlsx in your OneDrive (although any excel file will do as you are not actually going to work with the file).

     

    You can also download my "Office Script" directly from my blog here:

    https://www.tachytelic.net/wp-content/uploads/numberToEnglish.zip

    if you unzip it place it into your Onedrive\documents\Office Scripts folder, it will become available to you instantly.

     

    This is the place on stack overflow where I got the function from:

    https://stackoverflow.com/questions/14766951/transform-numbers-to-words-in-lakh-crore-system

     

    Warning: Office scripts are currently restricted to 200 executions per day, so this solution may not work for you if you need to run it more than that on a daily basis.

     

    Let me know how you get on.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard