+ Reply to Thread
Results 1 to 15 of 15

how do i format text (1, 2.35, 39) with different colors for each number?

  1. #1
    Registered User
    Join Date
    09-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    how do i format text (1, 2.35, 39) with different colors for each number?

    I have worksheets with lots of cells with 9 numbers separated by commas. An example would be (7, 8.35, 9, 10.5, 11, 12, 14, 18, 24)
    The 2nd, 5th and 8th need to be red, the 3rd, 6th and 9th need to be blue and the others black. This can be done during a concatenation of 9 cells or on the cell as is (formula or just copy of values)
    I have tried various of things but my knowledge of Excel is limited. I do have some programming experience but not in Excel.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,522

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    If the cell is using a formula to concatenate several values, you won't be able to do it. If the cell is just a text cell, albeit containing a series of numbers, you could do it manually or with a VBA Macro.



    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    ok here it is. I don't normally ask for help here so hope I got this right.
    Attached Files Attached Files

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    Quote Originally Posted by jettabar99 View Post
    I
    The 2nd, 5th and 8th need to be red, the 3rd, 6th and 9th need to be blue and the others black.
    What's the logic behind which number to colour and which colour to use?
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    09-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    Its based on the position only. Its always the 3rd, 6th and 9th as blue and 2nd, 5th and 8th as red - the other 3 black. I have lots of these per project and I have been doing them manually
    Last edited by jettabar99; 03-19-2021 at 05:04 PM.

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,418

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    You show Column L as being created with a formula... you cannot format parts of the output from a formula differently from each other... you can only do that with pure text values. To do that, you will need to use a VBA event procedure to create the values in Column L, then that same code can color the output as required. Is it okay for you to use a VBA code in your workbook?

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    This seems to work.
    Please Login or Register  to view this content.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,522

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    I decided to work this through so I might as well share it. Slightly different approach based on the original CONCATENATE formula.

    Please Login or Register  to view this content.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,522

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    And, if you want the brackets:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    Quote Originally Posted by TMS View Post
    And, if you want the brackets:

    Please Login or Register  to view this content.
    I feel pretty stupid right about now. How do I run this? I can create a module but I am not sure how to set it up to act on all the rows I need. Sorry for having to ask this - I have been trying to get it going. I have not done any programming in Excel.
    Last edited by jettabar99; 03-20-2021 at 09:56 AM.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,522

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    There are various ways to run it. You can add the Developer tab to the Ribbon and view and execute the macro from that. Or you could add View Macros to the Quick Access Tab. Or you could create a button and assign the macro to that.

    Or you can run it directly from the VBA Editor using the F5 key.

    You don't need to make any adjustments to the code. It will operate on any data in row 2 down.

  12. #12
    Registered User
    Join Date
    09-24-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    Thanks so much. It is working as far as I can tell. My problem seemed to be a break mode issue but now it seems to be working. I will try it on my main sheet now.

    Again - thanks everyone for your help!

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,522

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  14. #14
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,418

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    Here is one more macro approach to add to the mix...
    Please Login or Register  to view this content.

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,522

    Re: how do i format text (1, 2.35, 39) with different colors for each number?

    For completeness, the updated test sample file.
    Attached Files Attached Files

+ 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] How to Sum based on partial match of a cell in number format (not text format)
    By NBehrens in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-24-2017, 12:34 PM
  2. [SOLVED] VBA textbox populating cells in text format instead of number format
    By chrismccarthy17 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-03-2016, 07:46 AM
  3. [SOLVED] Number convertions: Number Format to Text Format
    By Old4xford in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-06-2015, 11:38 AM
  4. Replies: 16
    Last Post: 12-12-2014, 06:19 AM
  5. Convert date and time in serial number format to text format
    By nda13112 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2013, 02:45 PM
  6. Replies: 3
    Last Post: 08-08-2008, 06:12 AM
  7. Can't format font colors or cell fill-in colors
    By canoeron in forum Excel General
    Replies: 3
    Last Post: 08-22-2005, 07: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