+ Reply to Thread
Results 1 to 7 of 7

Highlighting numbers with corresponding negatives. (Tut - Please add to it)

  1. #1
    Registered User
    Join Date
    04-28-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2007 , 2010 , 2013
    Posts
    5

    Post Highlighting numbers with corresponding negatives. (Tut - Please add to it)

    Hi everyone. Just a quick how-to on the subject. Im no expert, just sharing my two cents so it might help somebody out. If you have a better way of doing this, by all means,
    please link below.

    Now, I work in accounting, so sometimes I need to find out if there are any numbers in my data that net to Zero (mostly these are reversals that I do not need in my sheets).

    So here, we have an example set of data with negatives and positives; that I created for who knows what reason. (You can download it below)


    Now, what we want is to highlight the numbers that have a net value of Zero.

    (1) Select your values:


    Name:  2.jpg
Views: 198
Size:  281.5 KB

    (2) Go to conditional formatting under Home, and select "New Rule":


    Name:  3.jpg
Views: 120
Size:  282.9 KB

    (3) Select Formula and Type in the formula that follows, and select what you'd like to do with it. I merely wanted it to highlight the cells in question to red:

    Name:  4.jpg
Views: 129
Size:  209.7 KB

    Please Login or Register  to view this content.
    (4) Press OK Twice (i.e. once on both windows) and the cells that net to zero should take on the formatting you desired:

    Name:  5.jpg
Views: 196
Size:  273.4 KB

    FORMULA ANALYSIS

    The Function

    Please Login or Register  to view this content.
    We have used the COUNTIF function. This is one of excel's statistical functions and it will count the number of cells based on criteria that you specify.

    The First argument

    Please Login or Register  to view this content.
    This part of our formula tells excel to look in a strictly limited range. You could, however change the range to "F:F" and excel will then look in the entire F range.

    The Middle argument

    Please Login or Register  to view this content.
    This part of our formula will multiply -1 with the value in the specified cell, i.e F4. (The last part is incremented to go with the corresponding cell i.e F5, F6, F7 etc). This is done to match ABSOLUTE (For example, if you have 30 and -30.4, these values will NOT be selected) opposites.

    The Ending argument

    Please Login or Register  to view this content.
    This part of the formula will help us format duplicate values / returning "TRUE". The opposite (=0) would format values that arent duplicates / return "FALSE"

    Additional Information

    Forum Guru TMS has pointed out the following:

    if you have two positive values and one negative, for example, 117, 117, -117, it won't highlight the negative number. And,if you have two or more matching pairs, it won't highlight any of the values.
    So you might want to keep that in mind.

    -----------------------

    Thats about it. I do understand that this is not exhaustive, but it gets the job done. If anyone has better explanations for what the different arguments in the formula do, please post them below and I will append them with credit to you.

    Cheers.
    Attached Files Attached Files
    Last edited by techypk; 05-27-2016 at 12:15 AM. Reason: Additional information added.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Highlighting numbers with corresponding negatives. (Tut - Please add to it)

    A good explanation of a common Accounting task.

    Can I offer a suggestion for improvement?

    Many contributors are not able to view .png files on this forum, due to software incompatibilities with some browsers. It might be better to replace them with .jpeg files, so that your explanations will make more sense to those people.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    04-28-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2007 , 2010 , 2013
    Posts
    5

    Re: Highlighting numbers with corresponding negatives. (Tut - Please add to it)

    ^ That is a very valid point, Pete. Replaced all PNGs with JPEGs.
    Cheers for your reply!
    If u want numbers of ur worth, count ur friends!

  4. #4
    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,463

    Re: Highlighting numbers with corresponding negatives. (Tut - Please add to it)

    Nice idea, well explained. However, being a little picky, if you have two positive values and one negative, for example, 117, 117, -117, it won't highlight the negative number. And,if you have two or more matching pairs, it won't highlight any of the values.
    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


  5. #5
    Registered User
    Join Date
    04-28-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2007 , 2010 , 2013
    Posts
    5

    Re: Highlighting numbers with corresponding negatives. (Tut - Please add to it)

    ^ Thankyou for your valuable input, TMS. Is there a work around for that?

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

    Re: Highlighting numbers with corresponding negatives. (Tut - Please add to it)

    Not tested, but I suspect you could get away with two separate conditions. The one you already have, which says there is one positive value and one negative value. And a second one that just counts identical values, plus or minus. You could use colour green where there is a single match and amber where there are multiple matches ... up to the user to decide what to do with them.

  7. #7
    Registered User
    Join Date
    04-28-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2007 , 2010 , 2013
    Posts
    5

    Re: Highlighting numbers with corresponding negatives. (Tut - Please add to it)

    I think if you put in a conditional formatting that highlights duplicates, it should overcome that, no?

+ 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: 8
    Last Post: 01-17-2024, 11:32 AM
  2. [SOLVED] Highlighting numbers that appear more than 3 times
    By Spotniq in forum Excel General
    Replies: 9
    Last Post: 01-15-2020, 03:52 AM
  3. [SOLVED] Help with HLOOKUP or SUMIF? to separate negatives or numbers with a - symbol and add them
    By DFaulstich in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-29-2015, 03:59 PM
  4. Trouble highlighting only four lowest numbers in a row
    By tankmccuin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-19-2014, 08:47 PM
  5. Trying to add a column of numbers, but ignoring negatives
    By Lord Waste in forum Excel General
    Replies: 5
    Last Post: 04-07-2009, 06:43 AM
  6. automatically highlighting numbers 0 and 1
    By lau260x in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2008, 03:52 PM
  7. making columns automatically turn numbers into negatives
    By Kathy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-01-2005, 02:06 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