+ Reply to Thread
Results 1 to 5 of 5

How to tell if a cell is % formatted

Hybrid View

  1. #1
    Registered User
    Join Date
    10-09-2006
    Posts
    13

    How to tell if a cell is % formatted

    Hey guys,

    I have a bunch of numbers formatted as either a percent or general. If the cell is percent formatted, I want to multiply it by 100.

    Do I have to use VBA? If so, real quick, what is the relavent code I should be using?

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    10-09-2006
    Posts
    13
    In the end, I want to be able to write a function where FUNCTION(CELL) returns the value of the cell*100 if the cell is % formatted, and just the value if not.

    Thanks!

  3. #3
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Thumbs up

    Quote Originally Posted by Dermot81
    In the end, I want to be able to write a function where FUNCTION(CELL) returns the value of the cell*100 if the cell is % formatted, and just the value if not.

    Thanks!
    Hi Demont81,

    If I understand correctly, you want all cells formatted as a % to become whole numbers instead? If so, type 100 (General Format) in a cell somewhere, copy it, then select all the % cells and Paste Special > Multiply

    Hope this is what you want

    oldchippy

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Dermot81
    In the end, I want to be able to write a function where FUNCTION(CELL) returns the value of the cell*100 if the cell is % formatted, and just the value if not.

    Thanks!
    in B1

    =findpc(A1)

    in Module1
    Function findPC(mycell As Range)
    Dim pCent As String
    pCent = mycell.NumberFormat
    If (Right(pCent, 1) = "%") Then
       findPC = 100 * mycell.Value
       Else
       findPC = mycell.Value
       End If
    End Function
    should work
    ---
    Last edited by Bryan Hessey; 10-23-2006 at 10:38 PM.
    Si fractum non sit, noli id reficere.

  5. #5
    Registered User
    Join Date
    10-09-2006
    Posts
    13
    Thanks, works well

+ 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