Share via

Typing Fractions in Word

Anonymous
2021-03-24T00:34:08+00:00

Hey there. Not looking for an existing solution but rather, I am making a suggestion for a problem that has no satisfactory solution (that I'm aware of). I'm a cabinet maker and I routinely create long lists, in Word, of dimensions that contain fractions. For instance "One cabinet door 24 1/2" x 11 9/16". When I create this in Word the program auto-corrects the 1/2 to a stylized font, while the 9/16 remains formatted as you see it now on this screen. (Go try now and see!) Now, I'm aware that I can Insert the various elements to make a stylized fraction from the Character Map but that is slow and clunky. I want the auto-correct to occur WHILE TYPING. I also understand that in Options there is a way to enable this feature but it only performs this for the most common fractions. In Cabinetry we deal in lots of fractions like 13/16, etc, which the formatting does not correct. It is possible that my research missed a way to perform this, and if so it'd be nice if you could point the way. However, if I'm right and there is no built-in solution, it'd be awesome if you folks could create something. Cheers!

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

18 answers

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 322.9K Reputation points MVP Volunteer Moderator
    2021-03-24T00:53:59+00:00

    Time to adopt the metric system.

    4 people found this answer helpful.
    0 comments No comments
  2. Charles Kenyon 166.5K Reputation points Volunteer Moderator
    2021-03-24T00:50:55+00:00

    You are right that it has long been a problem.

    See:  Creating Fractions by Suzanne Barnhill, MVP.

    I long ago decided to add AutoCorrect entries for the ones that I use and turn off the AutoFormat as you type entry for fractions (so they all look the same). I use a combination of superscript for the denominator and subscript for the numerator. These are separated by a slash. They are stored as formatted AutoCorrect. Other methods of creating them are discussed in Suzanne's article.

    Image

    Turn off the ones in AutoFormat as you type...

    Image

    4 people found this answer helpful.
    0 comments No comments
  3. Charles Kenyon 166.5K Reputation points Volunteer Moderator
    2021-03-24T01:45:46+00:00

    I used Jay Freedman's AutoCorrect2007 utility to make a backup of my fraction entries. You are welcome to try it.

    Here is a link to that backup document with the supplemental fractions.

    You would use it as a Restore source for Jay' utility and it would add the fractions shown in it to your AutoCorrect.

    Jay's Utility can be found on his Download page.

    1. Download the Utility
    2. Read the instructions on the download page.
    3. Download and save my AutoCorrect Fractions document where you can find it.
    4. First run a backup of your current AutoCorrect using the utility.
    5. Then run Restore using my document as the source.
    6. If asked whether you want to delete entries that do not appear in your current entries, say No.
    7. Check your AutoCorrect Options to see the fractions added.
    8. Uncheck the Autoformat as you type option for fractions.
    9. If you want, run the backup in the utility again.
    10. If prompted whether you want to save changes to the global template Normal.dotm when closing Word, say yes. (These formatted entries are stored in the normal template.)

    I make a backup of my AutoCorrect any time I add something that takes a fair amount of work or every six months or so.

    If you want to use one of the other methods for constructing Fractions set forth in Suzanne's page, you could do so and paste them into the Fractions document I produced and then run Jay's utility with that.

    A final note, my method using superscripted/subscripted characters works fine for me because I do not use single-spaced documents. See the note in Suzanne's article about spacing.

    Image

    I have my spacing set at Multiple 1.08 and the fractions created this way do not cause a problem. With single spacing you would need to use Exact spacing and it might end up cutting off characters.

    [Edit: macropod is correct that if you regularly write dates with only month and day, or month and year with a slash, this method will provide some surprises, that can be undone with Ctrl+Z if you notice in time. The same can be said of AutoFormat as you type with certain dates. His macros are more flexible than preparing AutoCorrect entries in advance.]

    2 people found this answer helpful.
    0 comments No comments
  4. Suzanne S Barnhill 277.1K Reputation points MVP Volunteer Moderator
    2021-03-24T12:43:23+00:00

    Just make sure to use the Fraction Slash (U2044) rather than the generic forward slash.

    1 person found this answer helpful.
    0 comments No comments
  5. Paul Edstein 82,861 Reputation points Volunteer Moderator
    2021-03-24T02:19:43+00:00

    I long ago decided to add AutoCorrect entries for the ones that I use and turn off the AutoFormat as you type entry for fractions (so they all look the same).

    One thing to watch out for when using AutoCorrect is that dates entered as D/M without the year might also get reformatted...

    For a macro solution that solicits the fraction for formatting as you input it, try:

    Sub EnterFraction()

    'Add this macro to your Normal.dot

    'Assign a keystroke like Alt-/ to this macro (Tools...Customize...Keyboard)

    'Prompt user for the text to format as a fraction

    fraction = InputBox("Enter fraction text (ex: 1/2, 5/32)")

    'Find the position of the slash in the text

    slashPosition = InStr(fraction, "/")

    'Quit if no slash in the text

    If slashPosition = 0 Then Exit Sub

    preSlash = Left(fraction, slashPosition - 1)

    postSlash = Right(fraction, Len(fraction) - slashPosition)

    With Selection

      .Font.Size = .Font.Size * 0.875

      'Type text before the slash as superscript

      .Font.Superscript = True

      .TypeText preSlash

      'Type the slash as normal text

      .Font.Superscript = False

      .TypeText "/"

      'Format text after the slash

      .Font.Subscript = True

      .TypeText postSlash

      'Continue with font back to normal

      .Font.Subscript = False

    End With

    End Sub

    or:

    Sub MakeFraction()
    Dim Fraction As String, Numerator As String, Denominator As String
    ActiveWindow.View.ShowFieldCodes = True
    With Selection
      ' For user input, you could use the following 2 lines to create a fraction
       Fraction = InputBox("Please input the Fraction (ex: 1/2, 5/32)")
       .Collapse (wdCollapseStart)
      ' Alternatively, to convert a selection, use the following line
      'Fraction = Trim(.Text)
      Numerator = Split(Fraction, "/")(0)
      Denominator = Split(Fraction, "/")(1)
      .Font.Size = Round(.Font.Size) / 2
      .Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
        PreserveFormatting:=False, Text:="EQ \f(" & Numerator & "," & Denominator & ")"
      .MoveLeft wdCharacter, 2
      .Delete
      .Fields.Update
    End With
    ActiveWindow.View.ShowFieldCodes = False
    End Sub

    The first of these simply takes an input string and reformats it, whilst the second employs an EQ field to deliver a comparable result, but formatted with a horizontal line between the numerator and denominator. The latter can even do the same with text strings.

    And, finally, here’s a macro with which you simply type your fraction into the document, select the fraction and run the macro - a process that can also be used for any existing fractions you might have.

    Sub Fraction()
    Dim RngTmp As Range, StrFrac
    With Selection
      StrFrac = Split(Selection.Text, "/")
      Set RngTmp = .Range
      With RngTmp
        .Font.Size = .Font.Size * 0.875
        .End = .Start + Len(StrFrac(0))
        .Font.Superscript = True
        .Characters.Last.Next.Font.Italic = True
        .End = .End + 2 + Len(StrFrac(1))
        .Start = .End - Len(StrFrac(1)) - 1
        .Font.Subscript = True
      End With
    End With
    Set RngTmp = Nothing
    End Sub

    1 person found this answer helpful.
    0 comments No comments