+ Reply to Thread
Results 1 to 4 of 4

Standardizing Data Format Formula

  1. #1
    Registered User
    Join Date
    10-19-2007
    Posts
    9

    Standardizing Data Format Formula

    Hello everyone. I have a spreadsheet with a column that lists room numbers for a hotel....some that are three digit, and some that are four. In order to derive an accurate floor number for these data entries, I need the room numbers to be reproduced in a new column, with a formula that determines how many characters the "ROOM" field data, is and then adds a leading zero to those room numbers that are only 3 digits in length.

    Example:

    If room is 1439, new column should simply reproduce the data unchanged: "1439"
    If room is 745 (3 digit), formula should reproduce room number as "0745"

    Thanks in advance!
    Last edited by VBA Noob; 01-04-2008 at 03:42 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You could custom format the columns as
    0000
    or use a formula like

    =TEXT(A1,"0000")
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    10-19-2007
    Posts
    9

    Unhappy No Good

    Hey Noob, thank you but the program im working with is on MS SharePoint which does not allow me to change the format of input ranges. However, once the data has been submitted in a Free Form Text fomat, I can create "calculated" columns that allow me to format the data....which is why I think I need an IF statement that works something like:

    IF number of characters in cell range = 3, result = "0 + data", otherwise the data should be unchanged

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    An if formula won't work if this didn't

    =TEXT(A1,"0000")
    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1