+ Reply to Thread
Results 1 to 8 of 8

Automatically fill a cell based on number - Column coloring

  1. #1
    Registered User
    Join Date
    05-02-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    20

    Automatically fill a cell based on number - Column coloring

    Google Translator:

    Hello everyone!

    I'm trying to solve one problem which consists of 3 parts.

    1) I writing numeric data into the table (range A2:G9). Data can be positive and negative. In row A10:G10 count the product of all the individual columns. If any cells (A2:A9) have a negative number (2 negative, 3 negative,...,8 negative) product in A10 should be negative (In mathematics product of two negative integers is a positive result). Values that would like to get are marked in yellow.

    2) If the products is positive (A10:G10), I would like to paint the cells in a column in green (D2:D9 and F2:F9).

    3) If forget to type the number in cell G2, taht my cell G10 displayed in red so can see that I forgot to type the number in cell G2.

    Thank You All For Help.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Automatically fill a cell based on number - Column coloring

    Quote Originally Posted by carduel View Post
    Google Translator:

    Hello everyone!

    I'm trying to solve one problem which consists of 3 parts.

    1) I writing numeric data into the table (range A2:G9). Data can be positive and negative. In row A10:G10 count the product of all the individual columns. If any cells (A2:A9) have a negative number (2 negative, 3 negative,...,8 negative) product in A10 should be negative (In mathematics product of two negative integers is a positive result). Values that would like to get are marked in yellow.

    Thank You All For Help.
    Can I question your assumption here. Take B2:B9. All 8 cells are negative and any negative number multiplied by another negative number is a positive. Since there are an even number of negative numbers mathematically speaking the total is a positive +720, not the negative you say it should be.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Automatically fill a cell based on number - Column coloring

    Hmm that was an interesting problem. I was trying my BEST to avoid having four nested IF statements and came across the ISEVEN formula. Basically when the count of negatives is EVEN you want to multiply by -1.

    This formula will work in cell A10, and you can drag it to the right.
    Please Login or Register  to view this content.
    Essentially I am determining IF the count of negatives is EVEN AND the count of negatives is greater than 1, then multiply the product formula by negative 1, otherwise just multiply by 1.

    Then the other conditional formatting is really simple with the following formules.
    Range A2:G9 conditional formatting formula:
    Please Login or Register  to view this content.
    Range A10:G10 conditional formatting formula:
    Please Login or Register  to view this content.

    Sample workbook with solutions is attached.
    Attached Files Attached Files
    Last edited by mikeTRON; 05-03-2016 at 04:14 PM.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  4. #4
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Automatically fill a cell based on number - Column coloring

    Hi-

    Here's part of your solution. Paste this into A10 and then copy across:

    =IF(COUNTIF(A2:A9,"<0")=0,PRODUCT(A2:A9),-1*ABS(PRODUCT(A2:A9)))

    Still looking at the conditional formatting.
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  5. #5
    Registered User
    Join Date
    05-02-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    20

    Re: Automatically fill a cell based on number - Column coloring

    Thank you very much.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Automatically fill a cell based on number - Column coloring

    Quote Originally Posted by carduel View Post
    Thank you very much.
    Just wanted to confirm that you are happy that the signage is correct for what you want. See post #2.
    Your result is not consistent with the normal mathematical rules that apply to mutiplying a set consisting of an even number of values all of which are negative.

  7. #7
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Automatically fill a cell based on number - Column coloring

    Quote Originally Posted by Richard Buttrey View Post
    Just wanted to confirm that you are happy that the signage is correct for what you want. See post #2.
    Your result is not consistent with the normal mathematical rules that apply to mutiplying a set consisting of an even number of values all of which are negative.
    Yeah, this is an odd request for sure

  8. #8
    Registered User
    Join Date
    05-02-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    20

    Re: Automatically fill a cell based on number - Column coloring

    Quote Originally Posted by Richard Buttrey View Post
    Just wanted to confirm that you are happy that the signage is correct for what you want. See post #2.
    Your result is not consistent with the normal mathematical rules that apply to mutiplying a set consisting of an even number of values all of which are negative.
    A negative number does not affect my calculations and we used only visually... I know that this way opposes mathematical rules but does not affect my result. I believe that my task can be solved by mathematical rules but my level of knowledge is my limit. What I imagined giving me accurate results.

    Thank you very much again.
    Last edited by carduel; 05-04-2016 at 03:48 PM. Reason: Adding text

+ 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. Automatically fill a cell based on text
    By wlbamc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-01-2016, 08:07 AM
  2. [SOLVED] Coloring cells based on random number values within a column.
    By InkyDrinky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2015, 01:53 PM
  3. Replies: 9
    Last Post: 01-14-2014, 11:04 PM
  4. Replies: 1
    Last Post: 07-02-2013, 08:58 PM
  5. [SOLVED] VBA referring to a different sheet, automatically fill cell based on content of other cell
    By mweick in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 02-06-2013, 11:50 AM
  6. Automatically fill in the values based on the value from another cell
    By nicholasma in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-20-2012, 05:51 AM
  7. Coloring Interior Fill based on range values
    By Jasrenkai in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-29-2011, 08:18 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