+ Reply to Thread
Results 1 to 5 of 5

conditional custom number format

  1. #1
    Registered User
    Join Date
    03-06-2009
    Location
    Philadelphia, PA USA
    MS-Off Ver
    MAC 2004
    Posts
    2

    conditional custom number format

    Hello,

    I am trying to create a number format for formatting resistor value in their most commonly displayed form. For example 1,200 ohms would be displayed as 1.2kΩ and 5,000,000 ohms would be displayed as 5MΩ, and finally 5 ohms would be displayed as 5Ω.

    I have been able to create a format that formats any 2 contiguous formats but not all three.

    for example: [>999999]###.0,,ΜΩ;[<1000000]###.0,kΩ;
    or: [>999]###.0,kΩ;[<1000]###Ω

    both work.(other similar criteria work as well) But if I try to put 3 conditions describing the desired formatting I get and error (containing no useful info) as I try to close the formatting dialog.

    Is there a limit to the number of conditions that can be used. Or something else I'm overlooking.

    Any help would be greatly appreciated.

    rbailets
    Last edited by rbailets; 03-08-2009 at 06:46 AM. Reason: mark as solved

  2. #2
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: conditional custom number format

    Could you consider using an additional row or column to hold an IF function which will display the value in the desired manner eg if a value is entered in B1 but displayed in say B3, the following formula entered in B3 would get the required results:

    Please Login or Register  to view this content.
    Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: conditional custom number format

    According to the note in the last item in the table on this site, you cannot have more than 2 conditions for a number format

    Custom Formats
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    Re: conditional custom number format

    You can solve this problem by using VBA. This is not quite as easy as conditional formatting but it works.

    This code is set to work only in column C. You can change the code as required. I have attached a sample sheet in case you are not an expert in VBA. Just enter data in column C. Press Alt-F11 to see the code.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-06-2009
    Location
    Philadelphia, PA USA
    MS-Off Ver
    MAC 2004
    Posts
    2

    Re: conditional custom number format

    Thank you.
    This VB solution seems to work quite well.
    I have been trying to get away from the multi-column solution which is not nearly as eloquent.

+ 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