+ Reply to Thread
Results 1 to 8 of 8

Formula for full custom type

  1. #1
    Registered User
    Join Date
    04-09-2019
    Location
    Cambridge, England
    MS-Off Ver
    O365
    Posts
    4

    Formula for full custom type

    Hi All
    I need a way of returning the full "custom type" of a cell's format. In my data set, the custom type varies line by line (because the software that exports the data is awful). They are all of type #,##0.00 and then have a different text value at the end. End goal - the data I'm after is file size and is exported as a number with a custom format to add the GB, MB, KB etc. (eg or example #,##0.00 "GB", #,##0.00 "MB", #,##0.00 "KB"). I need the "GB" etc returning so I can convert each cell to KB. I thought I could use =CELL("format", A2) but that doesn't give me enough detail.
    Any suggestions?
    Attached Images Attached Images

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Formula for full custom type

    You could use the old GET.CELL call, via Named Range, but you'd have to enable macros to make it work so I'd say you may as well use a custom UDF, e.g.:

    Please Login or Register  to view this content.
    above should be stored in a standard module in VBE, called from your cell along lines of:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    if you prefer, you could modify the Function to handle / aggregate all of the cells in the source range in one go.

    edit: tweaked to handle Bytes as missed that... modify multiplier as you need (e.g. 1024 vs 1000)
    Last edited by XLent; 04-09-2019 at 09:43 AM.

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Formula for full custom type

    If you want to make it all one measurement like KB the all you need to do is extract the number part of the cell and then depending on the text passed GB, MB of KB multiply accordingly
    KB by 1, GB by 1204 or whatever etc.
    Use a helper column to do that.

    Please Login or Register  to view this content.
    Place the above code in a common VBA module and you can use it in a formula or in VBA code
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Formula for full custom type

    In the name manager create a new named range & call it CellFormat, then in the refers to box put
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and save it.
    Then in B2 put
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    The file will need to be saved as an xlsm file

  5. #5
    Registered User
    Join Date
    04-09-2019
    Location
    Cambridge, England
    MS-Off Ver
    O365
    Posts
    4

    Re: Formula for full custom type

    Spot on, that's the easy fix i needed - thank you!

  6. #6
    Registered User
    Join Date
    04-09-2019
    Location
    Cambridge, England
    MS-Off Ver
    O365
    Posts
    4

    Re: Formula for full custom type

    Spot on, that's the easy fix i needed - thank you!

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Formula for full custom type

    Not sure you you're responding to, but glad we could help & thanks for the feedback

  8. #8
    Registered User
    Join Date
    04-09-2019
    Location
    Cambridge, England
    MS-Off Ver
    O365
    Posts
    4

    Re: Formula for full custom type

    Fluff13, I was responding to you - thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. working with a Custom Type
    By guyglk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2019, 07:25 PM
  2. [SOLVED] Type in an abbreviation and have cell return a full value. Is there a way to do this?
    By PaddyP in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-18-2016, 07:52 PM
  3. Type Initials, Auto Fills Full Name
    By woolyflick in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-29-2013, 03:51 PM
  4. Custom data type
    By excelishard69 in forum Excel General
    Replies: 4
    Last Post: 06-16-2013, 07:18 PM
  5. Replies: 1
    Last Post: 04-21-2012, 05:14 PM
  6. Replies: 3
    Last Post: 08-12-2008, 03:56 AM
  7. [SOLVED] Accessing Property of Custom Type
    By Ronin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2005, 05:05 PM

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