+ Reply to Thread
Results 1 to 8 of 8

Formula that returns conditional formatting when a percentage goes through a whole integer

  1. #1
    Registered User
    Join Date
    01-10-2017
    Location
    Asia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Formula that returns conditional formatting when a percentage goes through a whole integer

    Hi everyone,

    Trying to come up with a formula that compares two percentages, one from today, one from yesterday, and measures whether I have traveled through a whole percentage. I'd like it then to populate a square with something like "YES" if percentage has gone through a whole integer and NO if not.

    By "whole integer" I mean 1.0%, 2.0%, 3.0% as opposed to, for instance, 1.01%, 2.34%, 3.67%.

    Said another way, let's say on Monday I have 4.6% and then on Tuesday I have 7.2%, the formula would test to see if I had gone through a whole percentage (in this case I have gone through 5.0%, 6.0% and 7.0%, so YES).

    The data format is pretty simple.

    A1 has Monday's percentage (4.6%)
    B1 has Tuesday's percentage (7.2%)
    C1 has the answer (YES)

    I guess I am rusty as this sounds easy but is proving to be a challenge for me.

    Thanks your thoughts!

    J

  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,944

    Re: Formula that returns conditional formatting when a percentage goes through a whole int

    Hi, just so we are on the same page here, an integer is a whole number...1.0, 10.0, 100.0 etc, while a % is a decimal 0.01 (1%), 0.1 (10%) 1.1 (110%)

    So you want to know if the increase is exactly multiples of 0.01 difference?
    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
    01-10-2017
    Location
    Asia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula that returns conditional formatting when a percentage goes through a whole int

    Thanks very much for seeking the clarification, Ford. It was a struggle to express clearly.

    What I mean is, I want to test for when the figure in B1 goes through a whole number barrier, as it were.

    If A1 is 4.999 and B1 is 5.000 then that would return "YES" as the amount has gone from 4.x to 5.x. If A1 is 3.0 and B1 is 5.25 then that would return "YES" as the amount has gone through the whole number barrier of 4.0 and 5.0.

    Please let me know if I have expressed this lucidly.

    Best,

    J

  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,944

    Re: Formula that returns conditional formatting when a percentage goes through a whole int

    So are you dealing with % or not?

    Assuming not %...
    A
    B
    C
    D
    1
    4
    4.5
    FALSE
    No
    2
    4.5
    4.5
    FALSE
    No
    3
    4
    5
    TRUE
    Yes
    4
    4.5
    5.5
    TRUE
    Yes

    C1=INT(B1)-INT(A1)>0
    or
    D1=IF(INT(B1)-INT(A1)>0,"Yes","No")
    both copied down

  5. #5
    Registered User
    Join Date
    01-10-2017
    Location
    Asia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula that returns conditional formatting when a percentage goes through a whole int

    Hi Ford,

    INT works. Thanks-very cool. Awesome start.

    I am playing with =IF(INT(A1)-INT(B1)>0,"Yes","No")

    If A1 is 5, and B1 is 4, this formula works great! Correctly displays "YES." If A1 is 5 and B1 is 5, it works, too. Correctly displays "NO."

    IF A1 is 5 and B1 is 6, the formula still results in "NO" although it has traversed a whole number. I will play with it a bit.

    Many thanks, again.

    J

  6. #6
    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,944

    Re: Formula that returns conditional formatting when a percentage goes through a whole int

    IF A1 is 5 and B1 is 6, the formula still results in "NO" although it has traversed a whole number. I will play with it a bit.
    I see that you swapped the references around B1-A1 swapped to A1-B1
    The reason 5-6 is saying No is because the answer is -1 which is less than 0

    If you want this to ignore negative values, then wrap it in ABS...
    =IF(abs(INT(A1)-INT(B1))>0,"Yes","No")

  7. #7
    Registered User
    Join Date
    01-10-2017
    Location
    Asia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula that returns conditional formatting when a percentage goes through a whole int

    Quote Originally Posted by FDibbins View Post
    I see that you swapped the references around B1-A1 swapped to A1-B1
    The reason 5-6 is saying No is because the answer is -1 which is less than 0

    If you want this to ignore negative values, then wrap it in ABS...
    =IF(abs(INT(A1)-INT(B1))>0,"Yes","No")
    That is perfect, and I learned a lot here. Marking this solved.

  8. #8
    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,944

    Re: Formula that returns conditional formatting when a percentage goes through a whole int

    Happy to help

+ 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] Excel Macro for Conditional Formatting - Errors in Visual Basic due to integer?
    By LimeyAdam in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-27-2014, 08:42 AM
  2. Conditional Formatting formula - Percentage increase/decrease price colour
    By appsam1990 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-21-2014, 06:14 AM
  3. Conditional Formatting Formula for Percentage Ranking
    By josh86 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2014, 10:29 PM
  4. Conditional formatting percentage formula
    By Dan27 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-05-2014, 06:16 AM
  5. [SOLVED] Conditional formatting on a percentage
    By sunrunner4kr in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-20-2013, 11:28 AM
  6. Conditional formatting percentage
    By philip32686 in forum Excel General
    Replies: 5
    Last Post: 09-19-2011, 09:22 PM
  7. Conditional formatting a percentage
    By Wyatt12 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-22-2008, 12:23 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