+ Reply to Thread
Results 1 to 15 of 15

Formula to Change Colors If Total Numbers Gain or Lose

  1. #1
    Registered User
    Join Date
    07-24-2015
    Location
    Missouri
    MS-Off Ver
    2013
    Posts
    16

    Question Formula to Change Colors If Total Numbers Gain or Lose

    Hey Excel Forums, your buddy Noc here ready for round two! I am more of an organizing kind of person, so forgive me if these are really basic problems. Anyway, I am trying to get a system where if the number from the "gain/loss" changes, it will turn green if it gains and then red if it loses. So even if it gains for now, it might decrease from the next update. If it's green from an increase, I need it to turn red if it decreases later. Thank you for having me! Edit: Sorry if I was a little redundant haha.
    Attached Files Attached Files
    Last edited by NocSparta; 07-25-2015 at 07:46 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    If you mean the values in K2:K3, they look like they are manually entered/imported, and not based on any data from your table? (correct me if Im wrong please)

    If so, how would excel know what the previous value was, after you have replaced it?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    07-24-2015
    Location
    Missouri
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Yes, they are entered manually. But that's the thing, I was wondering if there was some way it would detect that the manually inserted number next time was lower or higher than the manual insert before.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    No, not with any regular formulas, it would hve nothing to compare against. perhaps with VBA

  5. #5
    Registered User
    Join Date
    07-24-2015
    Location
    Missouri
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    What is "VBA?" Edit: Just did some research, scripting.
    Last edited by NocSparta; 07-25-2015 at 04:35 PM.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Select K3 downwards as far as required

    HOME ==> Conditional Formatting==> New Rule==>Use a formula ...

    In Format values =K3<K2 ... FILL --> RED--> OK

    Repeat above

    enter =K3>k2 ... FILL ..>GREEN --> OK

    Enter data in column K as numbers (123456)

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    John, hopefully you picked up on something I missed, I read it that those values get replaced with each new "session"

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Ford,
    I may have missed that interpretation: having re-read the original posting it is (to my mind) ambiguous: and only having two entries in the sample would lead to your interpretation. If it is simply two entries only then your feedback is correct with VBA (code) being the only option.

    As I pointed out in a previous reply to Tony (Valko) the semantics/ambiguities of (English) language!

    John

  9. #9
    Registered User
    Join Date
    07-24-2015
    Location
    Missouri
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Ford got it right, new "sessions."

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Could you perhaps start keeping record of your data? In other words, instead of over-writing the "old" data, copy the new data to below it. that way, there would be a reference to work with

  11. #11
    Registered User
    Join Date
    07-24-2015
    Location
    Missouri
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    I'll talk to my friend and get back to you on that.

  12. #12
    Registered User
    Join Date
    07-24-2015
    Location
    Missouri
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Okay, I'm going to put in some more sample numbers you can work with with a new column to reference from.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    07-24-2015
    Location
    Missouri
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    It's been awhile since I've heard a response, is everything okay?

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Try this in CF

    =L2>K2 Green

    =L2<k2 Red

    Apply to L2:L3

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula to Change Colors If Total Numbers Gain or Lose

    Perhaps this...
    1. highlight the range you want to apply the conditional formatting to (the data in K and L, but avoid using full columns)
    2. on the home tab, styles, select CF
    3. select new rule, select use formula
    4. enter =AND(K3="",K2>K1) Format fill GREEN

    Repeat 3 and 4 with =AND(K3="",K2<=K1) Format fill RED

+ 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. Replies: 4
    Last Post: 03-10-2015, 07:28 AM
  2. Days Total Gain (%) - no pivot table
    By domgilberto in forum Excel General
    Replies: 18
    Last Post: 01-14-2015, 11:01 AM
  3. Formula for gain and loss within a column with a single cell running total
    By unusually_usual in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-11-2011, 10:22 AM
  4. Replies: 4
    Last Post: 03-29-2009, 01:37 AM
  5. Replies: 1
    Last Post: 10-07-2006, 01:01 PM
  6. Replies: 1
    Last Post: 11-14-2005, 03:30 PM
  7. Spreadsheet to do annual investment gain$, % gain, for list
    By notaspreadsheetgenius in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-09-2005, 04:08 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