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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Format Date

(1) ShareShare
ReportReport
Posted on by 4
How to get Year in Cardinal way
Eg: 2024 -> two thousand and twenty four
                   or
                   two zero two four
                   or
                   twenty twenty four
                   or
                   two thousand twenty four
cardinals.png
Categories:
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at
    Hi,
     
    i could not think of direct appraoch using expression to write the year in above format. Another way would be to utilize prompt based approach, write a prompt in AI Hub which converts the year to cardinal format like below
     
     
    Now use the prompt in generate text actions in power automate by passing year as input parameter to prompt.
     
    Refer the below one to see how the prompt can be used in power automate flow
     
    Hope it can help !
     

     
    Thanks & Regards,
    Nived N
  • Aswarth72 Profile Picture
    4 on at
    Thank you for your response. I believe AI builder has credit limit per month (PA premium), I have 15 MS forms to MS Word populate, runs almost 100 times a day, subsequently exhausts the 5k credits each month. Will try hard-coding for now based on the endsWith. Appreciate taking time to respond.
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at
    Hi,
     
    Just found another way to this, this logic is by creating office script in excel and running it by passing year as input parameter.
    Logic could have been built by power automate cloud flow itself as i think but may be flow becomes quite complicated. Keeping simple- we can try with office script.
     
    1. Create an excel file and write the following office script
    function main(workbook: ExcelScript.Workbook, inputNumber: number): string {
        // Convert the number to words and return the result
        return numberToWords(inputNumber);
    }
    
    // Helper function to convert number to words
    function numberToWords(number: number): string {
        if (number === 0) return "zero";
    
        const units = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
        const teens = ["", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"];
        const tens = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
        const thousands = ["", "thousand", "million", "billion"];
    
        let words = "";
    
        let thousandCounter = 0;
        while (number > 0) {
            let chunk = number % 1000;
            if (chunk > 0) {
                let chunkWords = convertChunk(chunk);
                words = chunkWords + " " + thousands[thousandCounter] + " " + words;
            }
            number = Math.floor(number / 1000);
            thousandCounter++;
        }
        console.log(words);
    
        return words.trim();
    
        function convertChunk(chunk: number): string {
            let chunkWords = "";
    
            if (chunk >= 100) {
                chunkWords += units[Math.floor(chunk / 100)] + " hundred ";
                chunk %= 100;
            }
    
            if (chunk >= 11 && chunk <= 19) {
                chunkWords += teens[chunk - 10] + " ";
            } else {
                chunkWords += tens[Math.floor(chunk / 10)] + " ";
                chunk %= 10;
                chunkWords += units[chunk] + " ";
            }
            
    
            return chunkWords.trim();
        }
    }
    
     
     
    Now create a flow something like below
     
    the result will contain output in word format of the number like below
     
     
    Hope it helps !
     
    Mark it as solution if it resolves your query !
     
    Thanks & Regards,
    Nived N

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 389

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard