+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    01-16-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    13

    Using conditional formatting to highlight a row based on the sumproduct formula

    I was given some guidance the other day with the sumproduct function. The below formula says tell me how many time 4 and 10 are in the same row in the data range i have specified.
    =SUMPRODUCT(--(COUNTIF(OFFSET(B2:D2,ROW(B2:D4)-ROW(B2:D2),0),4)>0),--(COUNTIF(OFFSET(B2:D2,ROW(B2:D4)-ROW(B2:D2),0),10)>0))

    Is there a way either through conditional formatting or another method were i can highlight the row if the formula applies which will make it easier to look over the data if there is a large amount of data? I have provided a screen shot to try and simulate what i am trying to acheive. (i have manually highlighted the counted rows)

    thanks

  2. #2
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,163

    Re: Using conditional formatting to highlight a row based on the sumproduct formula

    One way:

    Select entire range starting and go to Format|Conditional Formatting

    Select Formula Is from 1st drop down and enter formula:

    =AND(ISNUMBER(MATCH(4,$B2:$D2,0)),ISNUMBER(MATCH(10,$B2:$D2,0)))

    where B2:D2 is the top most row range in your entire selection

    Click Format and choose your colour pattern.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    01-16-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Using conditional formatting to highlight a row based on the sumproduct formula

    Quote Originally Posted by NBVC View Post
    One way:

    Select entire range starting and go to Format|Conditional Formatting

    Select Formula Is from 1st drop down and enter formula:

    =AND(ISNUMBER(MATCH(4,$B2:$D2,0)),ISNUMBER(MATCH(10,$B2:$D2,0)))

    where B2:D2 is the top most row range in your entire selection

    Click Format and choose your colour pattern.

    this is great thanks! can you make it apply to multiple rows? eg highlight every row where this occurs between row 2 and 4? i tried replacing $B2:$D2 with $B2:$D4 but it didn't work.

  4. #4
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,163

    Re: Using conditional formatting to highlight a row based on the sumproduct formula

    If you selected all the rows and applied that formula I gave you as suggested, then it will highlight all rows that fall into those conditions...

    alternatively, you can now copy B2:D2 and then select the rest of the rows... and go to Edit|Paste Special and select Formats... it will copy the formatting over.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0