• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Tachytelic.net

  • Sco Openserver
    • Sco Unix Support
    • SCO Openserver Installation ISOs
    • SCO Openserver Binaries
    • Add a Hard Drive to an Openserver 5 Virtual Machine
    • Install SCO Vision SQL-Retriever ODBC Driver on Windows 10
    • License Expired on Virtual SCO Openserver Installation
    • How to reset the root password on SCO Openserver 5
  • Scripting
    • PowerShell
      • Add leading zeros
      • Check if a File Exists
      • Grep with Powershell
      • Create Environment Variables
      • Test for open Ports
      • Append to a Text File
    • VBScript
      • Check if a File Exists
      • lpad and rpad functions
      • Windows Update E-Mail Notification
  • Office 365
    • Connect to Office 365 with PowerShell
    • Add or remove an email alias using Powershell
    • Change Primary email address of Active Directory user
    • How to hide an AD user from the Global Address List
    • How to hide mail contacts from the Global Address List
    • Change the primary email address for an account with PowerShell
    • Change Primary email address of an AD User
    • Grant a single user access to access to all calendars
    • Forward email to an external address using Powershell
    • Convert shared mailbox to user mailbox with Powershell
  • Get in Touch
  • About Me
    • Privacy Policy

Add st, nd, rd and th (ordinal) suffix to a number in Power Automate

November 22, 2020 by Paulie Leave a Comment

Sometimes you need to create an ordinal number for use in an email or similar situation. Power Apps does not have any support for this type of number formatting but it can be created quite easily with an expression.

The rules are as follows:

  • st is used for numbers ending in 1.
  • nd is used for numbers ending in 2
  • rd is used for numbers ending in 3
  • all other numbers end in th except…
  • Numbers ending in 11, 12, or 13 use th.

In Power Automate you can generate an ordinal number with the following expression:

if(endsWith(string(outputs('NumbeToConvert')),'12'),formatNumber(outputs('NumbeToConvert'), '#th'),
if(endsWith(string(outputs('NumbeToConvert')),'13'),formatNumber(outputs('NumbeToConvert'), '#th'),
if(endsWith(string(outputs('NumbeToConvert')),'1'),formatNumber(outputs('NumbeToConvert'), '#st'),
if(endsWith(string(outputs('NumbeToConvert')),'2'),formatNumber(outputs('NumbeToConvert'), '#nd'),
if(endsWith(string(outputs('NumbeToConvert')),'3'),formatNumber(outputs('NumbeToConvert'), '#rd'),
formatNumber(outputs('NumbeToConvert'), '#th')))))))

Where outputs(‘NumbeToConvert’) is the value you want to replace. An example flow using the above:

Image of a Power Automate Flow that creates an ordinal number.

The result is obviously 102nd:

Result of a Power Automate Expression that creates an ordinal number.

The flow simply uses the endswith function to determine the correct ordinal reference.

Hope this helps.

Related

Filed Under: Power Platform Tagged With: Power Automate

Reader Interactions

Leave a Reply Cancel reply

Primary Sidebar

Power Automate Support Image
Link to my LinkedIn Profile
Go to mobile version