+ Reply to Thread
Results 1 to 15 of 15

If Statement within conditional formatting

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    If Statement within conditional formatting

    Morning happy campers!

    Currently i have a CF set up as
    =$C2>$C$1
    which applies to a whole host of cells, essentially, if the figure in C2 is greater than in C1, the row changes colour.

    Column A - Name
    Column B - Date
    Column C - *formula*
    =TODAY()-B2
    (this continues down the sheet)

    I would like to add a CF that would look at the name in Column A and do the following:

    If the name in A2 onwards is duplicated AND the number in C2 onwards is LESS than C1, turn the line blue.

    Many thanks in advance

    Galvinpaddy

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: If Statement within conditional formatting

    Perhaps

    =And(countif($A:$a,$a2)>1,$C2<$C$1)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    Re: If Statement within conditional formatting

    Hi and thanks for the incredibly quick reply!

    I have added the formula but it does not change the colour.
    edit - i have set the format to change colour

  4. #4
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    Re: If Statement within conditional formatting

    \1

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If Statement within conditional formatting

    As i see that JOSEPH is ofline, i have to say that his formula works ok. Perhaps you need to modify a little the ranges...
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  6. #6
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    Re: If Statement within conditional formatting

    Hi Fotis,

    First off, thank you to JosephP for the intitial helper, and thankyou to fotis for the additional.
    However -

    Having looked at the attachment you sent, i cant work it out

    could you please modify the formula?
    where your sheet reads -
    =AND(COUNTIF($A$2:$A$1000,$A3)>1,$C3<$C2)
    Which looks at C3 being less than C2 - not an issue as i can change that to $C2<$C$1.

    Where i am struggling with is:

    When the name is duplicated AND the number is lower than the value in $C$1, i would like both instances of the row highlighted in blue, but no line would be highlighted if both are not under the value in C1

    I have attached the file to help explain.
    Thanks again
    Attached Files Attached Files

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If Statement within conditional formatting

    I must missing something here. So pls try to explain to me,

    Dan Smith in row 5 is duplicate name(row 3) and has the number in column C is 21. That means that is < than $C$1, WHICH IS BE 90

    Same situation for Tom Jones in row7.

    If the name in row 7 is John Something OR value in column C is >90. The row will not highlight.

  8. #8
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    Re: If Statement within conditional formatting

    Hi, so sorry, i do have a tendancy to not explain enough

    Ok, row3 is the same name as row5, BUT both the numbers are not below the value of C1 (90) so i dont want either of them to be highlighted.
    However, if 2 identical names exist and both numbers are under the value of C1 (90) then i would like both highlighting.

    Thanks, and sorry, again

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: If Statement within conditional formatting

    perhaps
    =SUMPRODUCT(($A$2:$A$1000=$A2)*($C$2:$C$1000<$C$1))>1

  10. #10
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    Re: If Statement within conditional formatting

    Edit - Sorry!!!
    I inserted a column next to A, ran
    =trim(A2)
    and copied all the way down, and now the conditional Format works, the question now is how can i stop that happening to blank rows?

    Kind regards

  11. #11
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If Statement within conditional formatting

    How about this simpler version?
    Attached Files Attached Files

  12. #12
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If Statement within conditional formatting

    Apologize. Wrong sample...
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    Re: If Statement within conditional formatting

    Good morning,

    I have tried the formula supplied but am still unable to get the required result.

    For example, in my worksheet i have the same name appear 5 times in Column A, in Column C the values are 138, 110, 97, 66, 12. Yet all are highlighted in blue.
    The CF i have entered is
    =SUMPRODUCT(($A$2:$A$1000=$A2)*($C$2:$C$1000<$C$1))>1
    And in the section where you define what area the formula applies to i have added
    =$A$2:$J$999
    Another side effect is that all rows currently blank within the range A2:J999 are now also blue.

  14. #14
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    884

    Re: If Statement within conditional formatting

    hi,
    I believe that does the trick, thank-you very much for your support.

    Much appreciation to you both

  15. #15
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If Statement within conditional formatting

    ..........................

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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