+ Reply to Thread
Results 1 to 41 of 41

Multiple colors in one cell

  1. #1
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Question Multiple colors in one cell

    Hi excel experts :)

    I'am using excel to calculate in-game currency income and expences.
    The currencies are:
    100 Copper, makes 1 Silver
    100 Silver, makes 1 Gold

    Currently I'am using this Userdefined formula code to make excel automatically sort the currencyes:
    Please Login or Register  to view this content.
    I would like to make it, that the value belonging to "G" is in yellow. "S" in Grey, and "C" in Brown.
    ex. 1624G 26S 15C

    Alongside with the above mentioned formula I am using a macro. But instead of changing the letters its commanded to, it is changing the color for all the letters.
    Please Login or Register  to view this content.
    Is it possible to add this funktion to the formula, or do I have to make it using VBA?
    -can you help me achieve this?
    I am a beginner to excel, and I found the above mentioned formula in Reddit.

    Kind regards,
    Last edited by Endlessfacepalms; 03-14-2018 at 03:14 PM.

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

    Re: Multiple colors in one cell

    Hi, welcome to the forum.
    I would suggest you apply conditional formatting for the cell coloring based upon the cell value.
    You can add multiple conditions
    ---
    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

  3. #3
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Hi Hans, and thank you for the answer.
    I have ben fiddiling arround with that until I hit the wall. and not being able to move on.
    Can you show me how I can use the method you mentioned in your previous reply?.

    Kind regards,

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

    Re: Multiple colors in one cell

    Sample file?

  5. #5
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Here it is.
    Attached Files Attached Files

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

    Re: Multiple colors in one cell


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

    Re: Multiple colors in one cell

    I have the file but do not see any values in G that make sense to me.
    I suggest you add some info like actual and what you want to see.

  8. #8
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Thank you for the video guide
    I took a look at the website. He doesnt show how to make a currency that have 000,00,00 and giving each dicimal its own color.
    I look forward to hear from you again.

    EDIT:

    G: Gold
    S: Silver
    C: Copper

    1G is 100S or 1G is 1000C
    1S is 100C
    Last edited by Endlessfacepalms; 03-15-2018 at 03:38 AM.

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

    Re: Multiple colors in one cell

    Then I do not understand what you mean

    Please Add a manual result of what you want to see as result to the sample file.
    It seems that I do not understand your question.

  10. #10
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    I will try my best.

    In a cell I would like to type the numbers 54836 without any commas or dots. The cell should convert the numbers automatically to the correct currency format and add the currency symbol for each part, which will be: 5G 48S 36C
    another example is, if I type 6872469. The cell should converts these numbers to the correct currency and add the currency symbols for each part, which will be: 687G 24S 69C
    and here is the same example but with a larger number 65873541. Will be converted to 6587G 35S 41C
    the numbers 103879454 should be converted to 10387G 94S 54C

  11. #11
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    To round all up. I would like to type a number in a cell. Lets use 23456789 as an example.
    In a cel I type: 23456789
    Cell auto formats the numbers to: 2345 67 89
    and gives each section of the numbers its own currency letter: 2345G 67S 89C
    and gives each section its own color: 2345G 67S 89C

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

    Re: Multiple colors in one cell

    I think it's going to be difficult and you will have to do this in VBA
    You want the text to color accordingly in both columns B and C?
    I'll see what I can do for the VBA part but it won't be before late this afternoon.

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

    Re: Multiple colors in one cell

    My answer crossed your post.
    Like I said, I'll try. But will you only be typing in Column B ?

  14. #14
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Thank you for taking time to help me with this.
    Column C is for calculating the Revenue or Loss between 2 days.

    Column B shows how much money there is in the Bank at the given date which you can see all the way to left.
    Column C shows the revenue or loss between two days.


    EDIT: Correction to the above.

    If you take a look at column C3.
    It is taking the value of B3 minus B2 = how much revenue was made. And give the result of the calculation their respective currency letters and coloring just like in column B.

    And again for C4.
    It takes the value of B4 minus B3 = how much revenue was made. And give the result of the calculation their respective currency letters and coloring just like in column B.
    In C4's case, there is 0 revenue because there was no new earnings. The money in the bank didnt increase or decrease. Therefore cell C4 spits 0 out.
    Last edited by Endlessfacepalms; 03-15-2018 at 04:36 AM.

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

    Re: Multiple colors in one cell

    Yes I noticed that, I suggest you change the formula in C starting in row 3

    Please Login or Register  to view this content.
    You do not need calculations if the value in B3 = empty or 0?

  16. #16
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    See my previous message.

    I placed the formula in C3, but it gave me an error "Formula doesnt contain recognizable text" #NAME?

  17. #17
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    If you take a look at column C3.
    It is taking the value of B2 minus B1 = how much revenue was made. And give the result of the calculation their respective currency letters and coloring just like in column B.

    And again for C4.
    It takes the value of B3 minus B2 = how much revenue was made. And give the result of the calculation their respective currency letters and coloring just like in column B.
    In C4's case, there is 0 revenue because there was no new earnings. The money in the bank didnt increase or decrease. Therefore cell C4 spits 0 out.
    Attached Files Attached Files

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

    Re: Multiple colors in one cell

    Yes I understood that and I expected a little more common sense on your part
    Here's the file with the formula inserted, and do NOT start in in the first row because there is NO previous value
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    I know that I'am terrible at explaining things, therefore I just wanted to make shure that I did it correctly.
    I have the utmost respect for your skills and knowledge.

    Thank you

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

    Re: Multiple colors in one cell

    Coloring cell text separately will not work with numbers and less with the number format settings.
    I managed something but column C will not work because it's a formula, it will be possible if the calculation is done with the same macro.
    Right now I did the following.
    You enter the numeric value in column B and the macro will convert it to text using the numberformat you set in that cell, that is important, that the numberformat be present.

    With that set the coloring works.
    I have attached the file with the macro and some tests.
    The vba module with the extractnumber udf is necessary so the calculations can work, it extracts the number from the text in column B

    Try this first and see if it works (only for column B)
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Column B is working perfectly :D
    I dont think it's worth fiddling with the coloring in column C. But if you take it as a challenge, you are more then welcome to do so

    Can you take a look at C6 and C7.
    its not "spreading" the results as it does with the numbers above it. Is it because the result is negative?
    Attached Files Attached Files

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

    Re: Multiple colors in one cell

    True, that's the reason and the number formatting does not allow more conditions, there is no if the else possible in number format. you would probably have to always process it as absolute value and then multiply by -1 the result should be negative but my guess is that that will not work.

  23. #23
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Does it mean that there is nothing to do about it?

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

    Re: Multiple colors in one cell

    Not this way (I think) you'll have to check where you found the number format you used, they might have some idea
    There might be alternative but you'll have to sort that out,
    - a helper column for the calculations (may be hidden) and a results column showing the correct result
    - fully macro processing?
    You'll have to invest some time in vba coding

  25. #25
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Thumbs up Re: Multiple colors in one cell

    Alright Thank you very much for the help
    you gave me some information that I can research on and move from there

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

    Re: Multiple colors in one cell

    It went faster than I expected, I'll let you research, and advice you do so, VBA is very versatile and you require a lot of imagination, insensitivity and a lot of time and patience (troubleshooting)
    I modified your file. The formula is now in a hidden column D with just a number format to show large + and - numbers but not the 0 values
    The macro takes the value in that column and transforms it and if it's negative the - sign is added as prefix.
    If the tables on the right are dependent of these columns you will have to keep in mind that there is a hidden column (D) in between.

    You can continue and fine-tune from here.
    Attached Files Attached Files

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

    Re: Multiple colors in one cell

    I think I got it working with negative and positive values
    Attached Files Attached Files

  28. #28
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    I am already watching some youtube tutorials

    I took a look at both of your latest uploads.
    The +/- are working great.
    But now we have a new issue with the coloring.
    It seems to get confused regarding the coloring when the value is negative.
    Attached Files Attached Files

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

    Re: Multiple colors in one cell

    Not when I tested here , did you try file 3?

  30. #30
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Yes I did it with file 3.
    I have attached file 3. And in case that you cant see the error on your side, i also attached a screenshot.
    Attached Images Attached Images
    Attached Files Attached Files

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

    Re: Multiple colors in one cell

    Found it, and corrected it, it's the ' in front of the - which is required to show the string with negative values,
    Attached Images Attached Images
    Attached Files Attached Files

  32. #32
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    I can confirm thats its working on this side too
    Is it possible to make the calculation thingy working all the way down to row 366?
    Attached Files Attached Files

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

    Re: Multiple colors in one cell

    You can do that yourself.
    loo at the vab code in the akt worksheet
    Please Login or Register  to view this content.
    This is the are it checks now so .... yes you got it change this to B366, wow, you'r e a genius.

    BUT

    First you must unhide column D

    Then select the the cells of the last row as shown in the figure and with the left mouse button (red arrow) click and drag the rows down to 366, this will copy the formatting and formulas all the way down.
    Hide column D and voila
    Attached Images Attached Images

  34. #34
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    At least we share the same opinion regarding your genioutisy :P
    I changed it to 731 instead of 366. and got this error.
    Attached Images Attached Images

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

    Re: Multiple colors in one cell

    Yes, and I was expecting that much. the reason is now that you have to edit the vba code to do all your calculations, since the values in between are no 0 but blank then you get the error finding what to add.
    It's the fact that the row above is blank, it does not recognize it as zero, or you add a check to avoid this and do no calculation or else place 0 in the cell above before calculating (via the macro)
    And my next question, why the dates and empty rows? if you have no entry for a date why enter the row?
    You see VBA and programming in general is taking into account ALL options and what do with what condition

  36. #36
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    It was caused by the date format
    Does it get confused because because there is 2 or more dates with the same day number?

    but if there is no numbers on the abouve cell it will give an error. Which is fair, because there must be a number no matter how low the bank account falls down.

    EDIT: I thought the above was the problem, but I messed it all up now
    Last edited by Endlessfacepalms; 03-17-2018 at 04:55 AM.

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

    Re: Multiple colors in one cell

    The date has nothing to do with it because it's not taken into account in the vba code.
    I'll check later this weekend i'm going out now,

  38. #38
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    Have a good weekend

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

    Re: Multiple colors in one cell

    You too, enjoy and test this one
    Attached Files Attached Files

  40. #40
    Registered User
    Join Date
    03-14-2018
    Location
    Copenhagen
    MS-Off Ver
    2010
    Posts
    20

    Re: Multiple colors in one cell

    You are an Excel legend! :D
    Thank you for spending your time on helping me
    Every thing is working perfectly

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

    Re: Multiple colors in one cell

    You're welcom

+ 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. Changing cells and column chart colors based on cell colors
    By HDeuce in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2016, 11:43 AM
  2. Replies: 16
    Last Post: 12-12-2014, 06:19 AM
  3. Replies: 1
    Last Post: 08-01-2014, 10:33 AM
  4. Replies: 2
    Last Post: 01-27-2012, 09:40 PM
  5. multiple colors in same cell
    By Calman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-29-2007, 02:02 AM
  6. multiple text colors in a cell
    By Gary Keramidas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2006, 09:10 PM
  7. [SOLVED] multiple colors for one cell
    By heatherz70 in forum Excel General
    Replies: 2
    Last Post: 01-30-2006, 04:25 AM

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