+ Reply to Thread
Results 1 to 7 of 7

Help about a text custom format, please

Hybrid View

  1. #1
    Registered User
    Join Date
    03-16-2022
    Location
    Arraiolos, Portugal
    MS-Off Ver
    2013
    Posts
    4

    Help about a text custom format, please

    Good night to all. This is my first post here and I thank you in advance for your answers.
    I'm no expert in Excel, far from that!

    My question is about a number format and I'll try to explain.

    It can be a simple number like (1234), or have an additional (1234-34), or even (1234-34.55.4)
    The numbers after the minus signal will always be great than zero (0), otherwise the "minus" will not show.

    Something like:

    1234 (top number)
    -> -34 (first indentation with a "minus")
    -> .34 (other indentations always with a dot ".")
    -> .6

    I hope I could explain the problem.

    Thank you again!

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,361

    Re: Help about a text custom format, please

    Cells containing something like 1234-56 or 1234-56.78.9 are going to be text strings, and number formatting is not going to do much with text strings. We will probably need a better understanding of exactly what you want to do here. Are you entering numbers but want them to appear as text strings? Are you entering text strings, but you want to display the text different from the entered text value?

    If I enter 9 digit numbers (123456789) and then use a number format code like 0000"-"00"."00"."0, then I can get 123456789 to display as 1234-56.78.9, but be very clear in your mind that the underlying cell value of such a formatted number is still 123456789. Something like 1234 will display as 0000-01.23.4. Something like 123400000 will display as 1234-00.00.0.

    Help us understand better what you are wanting to do here (what value are you wanting to enter into the cell and how do you want that value displayed). I'm not certain that number formatting alone will achieve what you want, but we can explore possibilities when we better understand your goals.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    03-16-2022
    Location
    Arraiolos, Portugal
    MS-Off Ver
    2013
    Posts
    4

    Re: Help about a text custom format, please

    Thank you MrShorty!
    Let's see if I can explain the thing.
    I have a lot of technical drawings, beginning from the 80's until now, that have a numeral system this:
    1 - If the object is simple, let's call it an "element", is made from one drawing, like drawing number (20).
    2 - If the object is made from several "elements", it as a final drawing showing how the elements have to be combined (20), and a list of all the elements. Each one of the elements have a drawing of themselves (20-1), (20-2), etc...
    3 - If one or more of that small pieces that make the big one are a little more complex, they to have a list of smaller pieces, like (20-1.1) (20.1.2), etc....

    If I have a column with all the different drawing numbers I cannot order them as I want.
    This is the order that I get when Ordering Ascendant:
    12
    113
    145
    150
    145-1
    145-1.2
    150-1
    150-1.2

    This is what I would expect:
    12
    113
    145
    145-1
    145-1.2
    150
    150-1
    150-1.2

    Does that make sense to you?

    Thank you again!

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,361

    Re: Help about a text custom format, please

    That does make sense. Is the real problem the sorting issue then? What it seems we have is a mix of numbers and text strings. As noted above, numbers are all smaller than text, so it appears that Excel is sorting all the numbers in increasing numeric order, then sorting all the text in increasing text order.

    The usual solution I see to this is to parse the text so that each element is in its own cell/column/field as a number. Is that allowed? Text to columns can do this quite readily. One time through using "-" as the delimiter, and a second pass through using "." as the delimiter. Then, each element is in its own field as a number. Then call up the sort algorithm and tell it to sort first by the first column, then add level to tell it to sort by the second column, and so on for as many elements/columns/fields you have.

    In order to get the correct sort, my version of Excel wanted 0s instead of blanks in the empty element spaces. On this small sample, that was not difficult to do manually, but, on a larger sample, that may get tedious to do manually. You might see if this is also going to be necessary in your version, and consider how to handle this issue.

  5. #5
    Registered User
    Join Date
    03-16-2022
    Location
    Arraiolos, Portugal
    MS-Off Ver
    2013
    Posts
    4

    Re: Help about a text custom format, please

    Yes, the real problem is sorting the Excel Table.
    Sorry for the noob question. Is it possible to make some kind of formula for sorting things?
    Or to I have to separate the numbers by columns to do the sorting?

    Thank you!

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,361

    Re: Help about a text custom format, please

    Separating into columns was just the first possibility. I'm sure there are other approaches to solve this. Other than making a custom list (which would require you to know all of your possible combinations of elements), any approach that I can think of involves doing something to the data to turn it all to real numbers in a way that sorts correctly by numeric sort order, or turn all of the numbers to text strings in a way that they sort correctly by text sort order rules.

    Whether you opt to use the Sort utility, or formulas to perform the sort, or however you decide to perform the sort, Excel is going to want something done to the data to get it into a form that Excel can sort correctly. If you don't like parsing into columns, I could see converting the inputs to decimal numbers like 1234.345504, 12, 145.01, 145.0102 etc. If you prefer a text sort, then rework the data into something that will sort correctly as text. What's your preference?

    As for a formula based approach to sorting, I outlined the way I do it (numeric sort order only) in a post the other day https://www.excelforum.com/excel-gen...ml#post5649786 This part only works after getting the data into an all number format, so the main problem is still how to get the data from your raw inputs into something that Excel can sort.

  7. #7
    Registered User
    Join Date
    03-16-2022
    Location
    Arraiolos, Portugal
    MS-Off Ver
    2013
    Posts
    4

    Re: Help about a text custom format, please

    No small task, have to try to solve it with the enlightenment you gave me by discussing with me the problem!

    Thank you again!
    Stay well!

+ 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. [SOLVED] Add text to a custom format
    By lynnsong986 in forum Excel General
    Replies: 2
    Last Post: 01-09-2020, 10:08 PM
  2. How to custom format a text
    By bigscientist in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-28-2019, 07:46 PM
  3. Custom format to text same as custom format
    By selim69 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-21-2018, 08:12 AM
  4. [SOLVED] Custom cell format - text with text
    By Mechjo16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-31-2017, 05:02 PM
  5. Help with custom text format
    By stephme55 in forum Excel General
    Replies: 3
    Last Post: 06-23-2016, 03:34 PM
  6. [SOLVED] Custom format with text
    By PierreL in forum Excel General
    Replies: 2
    Last Post: 10-14-2005, 02:05 PM
  7. [SOLVED] Custom format text
    By coco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2005, 01:05 PM

Tags for this Thread

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