How do you add feet/inches to excel

arkitek 20 Reputation points
2026-09-08T17:30:14.3266667+00:00

I am trying to figure out how to get custom format to show up like " 24'-0" "

is there a way to do this? im trying to get the feet/inches to show up ...i.e. 24-0 or 24 0 and becomes 24'-0"

any clue on how to do this?

Thank you.

Howard

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments

Answer accepted by question author
Ryan-N 15,565 Reputation points Microsoft External Staff Moderator
2026-09-08T18:12:36.44+00:00

Hi arkitek,

Welcome to the Microsoft Q&A forum.

According to your description, you would like Excel to automatically display 24'-0" when you enter 24-0.

You can use VBA to achieve this.

Step 1: Open your Excel workbook, then press Alt + F11 to open the VBA Editor.

Step 2: In the left-hand pane, under Microsoft Excel Objects, select the worksheet where you want to apply this setting.

Step 3: Paste the following VBA code into the worksheet's code window:

Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Count > 1 Then Exit Sub
    If IsEmpty(Target) Then Exit Sub

    Application.EnableEvents = False

    If InStr(Target.Value, "-") > 0 Then

        Dim Arr() As String

        Arr = Split(Target.Value, "-")

        If UBound(Arr) = 1 Then
            Target.NumberFormat = "@"
            Target.Value = Arr(0) & "'-" & Arr(1) & Chr(34)
        End If

    End If

    Application.EnableEvents = True

End Sub

Step 4: Close the VBA Editor, then try entering 24-0 to see the result.

User's image

 I hope this information is helpful.

If you have any questions or need further assistance, please feel free to share them in the comments on this post so I can continue to support you.

I look forward to continuing the conversation.


If the answer is helpful, please click "Yes" and kindly upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.