Skip to content

TechRepublic

  • Top Products Lists
  • Developer
  • 5G
  • Security
  • Cloud
  • Artificial Intelligence
  • Tech & Work
  • Mobility
  • Big Data
  • Innovation
  • Cheat Sheets
  • TechRepublic Academy
  • CES
  • TechRepublic Premium
  • Top Products Lists
  • Developer
  • 5G
  • Security
  • Cloud
  • Artificial Intelligence
  • Tech & Work
  • Mobility
  • Big Data
  • Innovation
  • Cheat Sheets
  • TechRepublic Academy
  • CES
  • See All Topics
  • Sponsored
  • Newsletters
  • Forums
  • Resource Library
TechRepublic Premium
Join / Sign In
Microsoft

Screenshots: Add ordinals in Excel

By Susan Harkins November 20, 2013, 10:31 AM PST

Image
1
of 12

20_ordinal_excel.png
20_ordinal_excel.png
Screenshots: Add ordinals in Excel

Pro tip: Add an ordinal indicator to a value in Excel

Pro tip: Add an ordinal indicator to a value in Excel

Adding an ordinalrnindicator – st, nd, rd, and th – uses a suffix to denote the value’srnposition within a series. For example, 1 becomes 1st, 2 becomes 2nd, 3 becomesrn3rd, and so on. In Excel, you can use a complex formula to create a new string orrnyou can apply several conditional formatting rules to display the indicatorrnwith the value.

rnrn

Excel 2003 users must use the formula solution. If you wantrnto apply the conditional formatting technique, you must have Excel 2007 orrnlater.

rnrn

The rules

rnrn

Knowing the rules and their precedence is imperative. Tryingrnto apply ordinals without knowing the following rules will just make you sad:

rnrn

    • rn

    • Values ending in 0 alwaysrn get th.

rn

    • Values ending in 1 get st unless the value is 11 or a valuern that ends with 11.

rn

    • Values ending in 2 get nd unless the value is 12 or a valuern that ends with 12.

rn

    • Values ending in 3 get rd unless the value is 13 or a valuern that ends with 13.

rn

    • Everything else gets th.

rn

rnrn

Getting the rules applied in the correct order is the key.rnThe values 11, 12, and 13 certainly throw a monkey wrench into the works, butrnExcel can handle it.

2013251.JPG
2013251.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 1

Add ordinals in Excel 1

In the figure below, I’ve used a formula to combine a valuernand its appropriate ordinal indicator:

rnrn

=value&IF(AND(MOD(ABS(value),100)>10,MOD(ABS(value),100)<14),"th",CHOOSE(MOD(ABS(value),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))

rnrn

This formula has been in use for a long time. If you try arnshorter version, be sure to check the results for values ending with 11, 12,rnand 13 carefully. Most importantly, this formula returns a string, not a value;rnyou can’t refer to the results of the formula in mathematical equations.

rnrn

Although long, the formula is simple. The first part of thernformula accommodates values ending with 11, 12, and 13. The second part of thernformula uses CHOOSE() to handle the rest. I suppose you could simplify bothrncomponents, but I’ve never tried. This works, and I can’t justify the time itrnwould take to rethink it. It works with positive and negative integers,rnignoring decimal components.

rnrnCredit: Image by Susan Harkins for TechRepublic

2013252.JPG
2013252.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 2

Add ordinals in Excel 2

A conditional format

rnrn

You can also use a conditional format. This method displaysrnthe indicator with the actual value rather than creating a new string. Thernoriginal value remains a numeric value. You only change the way Excel displaysrnthat value.

rnrn

You’ll need six formulas instead of one; use the formulasrnlisted in Table A.

rnrn

Table A

rnrn

rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrn

rn

4-9

rn

rn

th

rn

rn

=AND(MOD(ABS(A1),10)>3,MOD(ABS(A1),10)<10)

rn

rn

0

rn

rn

th

rn

rn

=MOD(ABS(A1),10)=0

rn

rn

1

rn

rn

st

rn

rn

=MOD(ABS(A1),10)=1

rn

rn

2

rn

rn

nd

rn

rn

=MOD(ABS(A1),10)=2

rn

rn

3

rn

rn

rd

rn

rn

=MOD(ABS(A1),10)=3

rn

rn

11, 12, 13

rn

rn

th

rn

rn

=AND(MOD(ABS(A1),100)>10,MOD(ABS(A1),100)<14)

rn

rnrn

You must enter thernabove rules in their listed order. There are other routes and other formulas,rnbut this route specifies each rule in ordinal precedence. If you use otherrnrules, be sure to account for the application order, which can get messy – itrnisn’t impossible, but it is morerndifficult to follow.

rnrn

Now, let’s apply the first rule to the values shown below:

rnrn

    1. rn

    2. Select the data. In thisrn case, that’s A1:H20.

rn

    1. In the Styles group on thern Home tab, click Conditional Formatting.

rn

    1. Choose New Rule.

rn

    1. In the New Formatting Rulern dialog, select the last option in the upper pane: Use A Formula Torn Determine Which Cells To Format.

rn

    1. Enter the “th”rn rule for the 4-9 rule:

rn

rnrn

=AND(MOD(ABS(A1),10)>3,MOD(ABS(A1),10)<10)

rnrnCredit: Image by Susan Harkins for TechRepublic

2013253.JPG
2013253.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 3

Add ordinals in Excel 3

    1. rn

    2. Click Format.

rn

    1. Click the Number tab.

rn

    1. In the Category list,rn select Custom.

rn

    1. In the Type field, enterrn the custom code: 0″th”

rn

rnrn

You can skip that last step if you like. I’m also usingrncolor to highlight the formatted values. Doing so creates a nice visual trailrnto follow, but you probably won’t want to apply color to the values you formatrnin your own sheets. Click the Fill tab, choose a color, and click OK.

rnrn

Click OK twice. This first rule adds th to values endingrnwith the digits 4 through 9.

rnrn

Repeat this process for the remaining rules, being carefulrnto add them in the listed order. When you enter the rules for 1, 2, and 3,rnyou’ll notice that Excel also formats the values ending with 11, 12, and 13,rnwhich is incorrect. Don’t worry because the final rule for 11, 12, and 13 willrnoverride the earlier rules where necessary.

rnrnCredit: Image by Susan Harkins for TechRepublic

2013254.JPG
2013254.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 4

Add ordinals in Excel 4

Credit: Image by Susan Harkins for TechRepublic

2013255.JPG
2013255.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 5

Add ordinals in Excel 5

Credit: Image by Susan Harkins for TechRepublic

2013256.JPG
2013256.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 6

Add ordinals in Excel 6

Credit: Image by Susan Harkins for TechRepublic

2013257.JPG
2013257.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 7

Add ordinals in Excel 7

Credit: Image by Susan Harkins for TechRepublic

2013258.JPG
2013258.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 8

Add ordinals in Excel 8

Credit: Image by Susan Harkins for TechRepublic

2013259.JPG
2013259.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 9

Add ordinals in Excel 9

Credit: Image by Susan Harkins for TechRepublic

2013260.JPG
2013260.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 10

Add ordinals in Excel 10

Credit: Image by Susan Harkins for TechRepublic

2013261.JPG
2013261.JPG
Screenshots: Add ordinals in Excel

Add ordinals in Excel 11

Add ordinals in Excel 11

Bottom line

rnrnUsing conditional formatsrnto apply ordinal indicators can be problematic. First, you must be careful tornconsider precedence when entering the rules. My way isn’t the only way and itrnisn’t the most efficient, but it is easy to follow. Second, if you’re workingrnwith other conditional formats, you must continue to consider precedence. Yourncan combine rules and use the Stop If True property appropriately whenrncombining this set of rules with others. Next month, I’ll show you how to addrnordinal indicators to dates.

rnrnCredit: Image by Susan Harkins for TechRepublic

  • Microsoft
  • Software
  • Account Information

    Share with Your Friends

    Screenshots: Add ordinals in Excel

    Your email has been sent

Share: Screenshots: Add ordinals in Excel
Image of Susan Harkins
By Susan Harkins
Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.
  • Account Information

    Contact Susan Harkins

    Your message has been sent

  • |
  • See all of Susan's content

TechRepublic Premium

  • TechRepublic Premium

    Guidelines for building security policies

    PURPOSE These guidelines from TechRepublic Premium will help you define the necessary ingredients of a security policy and assist in its proper construction. They’re designed to work hand in hand with the subjective knowledge you have of your company, environment and employees. Using this information, your business can establish new policies or elaborate on those ...

    Published:  March 23, 2023, 12:00 PM EDT Modified:  March 24, 2023, 1:00 PM EDT Read More See more TechRepublic Premium
  • TechRepublic Premium

    Hiring kit: Artificial intelligence architect

    PURPOSE Recruiting an Artificial Intelligence Architect with the right combination of technical expertise and experience will require a comprehensive screening process. This Hiring Kit from TechRepublic Premium provides an adjustable framework your business can use to find, recruit and ultimately hire the right person for the job. From the hiring kit: DETERMINING FACTORS, DESIRABLE PERSONALITY ...

    Published:  March 23, 2023, 12:00 PM EDT Modified:  March 24, 2023, 1:00 PM EDT Read More See more TechRepublic Premium
  • TechRepublic Premium

    Hiring kit: Autonomous systems engineer

    PURPOSE Hiring the right Autonomous Systems Engineer requires a specific and precise recruitment process, supported by a thorough understanding of the project requirements. This Hiring Kit from TechRepublic Premium provides an adjustable framework your business can use to find, recruit and ultimately hire the right person for the job. From the hiring kit: DETERMINING FACTORS, ...

    Published:  March 23, 2023, 12:00 PM EDT Modified:  March 24, 2023, 3:00 PM EDT Read More See more TechRepublic Premium
  • TechRepublic Premium

    Hiring kit: Application support engineer

    PURPOSE This Hiring Kit: Application Support Engineer from TechRepublic Premium provides an adjustable framework your business can use to find, recruit and ultimately hire the right person for the job. From the hiring kit: DETERMINING FACTORS, DESIRABLE PERSONALITY TRAITS AND SKILLSETS The skillset of successful Application Support Engineers is marked by balancing the technical expertise ...

    Published:  March 23, 2023, 12:00 PM EDT Modified:  March 24, 2023, 5:00 PM EDT Read More See more TechRepublic Premium

Services

  • About Us
  • Newsletters
  • RSS Feeds
  • Site Map
  • Site Help & Feedback
  • FAQ
  • Advertise
  • Do Not Sell My Information

Explore

  • Downloads
  • TechRepublic Forums
  • Meet the Team
  • TechRepublic Academy
  • TechRepublic Premium
  • Resource Library
  • Photos
  • Videos
  • TechRepublic
  • TechRepublic on Twitter
  • TechRepublic on Facebook
  • TechRepublic on LinkedIn
  • TechRepublic on Flipboard
© 2023 TechnologyAdvice. All rights reserved.
  • Privacy Policy
  • Terms of Use
  • Property of TechnologyAdvice