+ Reply to Thread
Results 1 to 12 of 12

Conditional Format to <sum current cell> + <5 cells above and below>

Hybrid View

  1. #1
    Registered User
    Join Date
    07-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Conditional Format to <sum current cell> + <5 cells above and below>

    Hi All,

    I need to Conditional Format every cell in my work sheet. No matter which cell I click on...
    1. if SUM of 'current cell' + '5 cells above and/or below' is > 60, make the cell red

    This might be a circular reference, however, I thought Conditional Formatting would handle it...?

    Can someone please advise how I would apply this Conditional Format to every cell?

    What I've done so far...
    After selecting 'every cell' in the work sheet, I've applied a Conditional Format something like this.

    =if(SUM(or(OFFSET(address(row(),Column()),0,0,5,1))>60,(OFFSET(address(row(),Column()),0,0,-5,1))>60,),1,0)

    This may or may not be the right way, but in any case it's not working for me...Any help would be greatly appreciated

    Nelg

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Hi Nelg,

    I have used a defined name in conditional formatting to achieve the desired results, see the attached file. Thanks.
    CF for 5 up & down.xlsx

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    07-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Thanks for the response DILIPandey,

    Your suggestion might work...
    I haven't used this function before and I'm a little confused as to how you've set the functin up.
    I've googled 'defining names' and followed/understand the process, however I don't understand how you've given the instruction to reference the 'current cell'
    eg. I go into 'name manager' and I see the formula =OFFSET(Sheet1!H19,-5,0,11,1).
    the 'name manager' knows I am in Cell H19. can you advise how you set this up?

    Many, many thanks

    Nelg

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Hi Nelg,

    You got it right.
    Name manager knows that you are in cell H19 and when you move down / up, the reference will also be changed for H19. From H19 it collects the range -5 (i.e., 5 cells up) to 11 (i.e, 11 cells down).. hence making it 5 +1 +5 = 11 cell range always

    the formula syntax is (in easy words) = offset(reference, +/- rows, +/ - columns, height of range in cell count, width of range in cell count)

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Registered User
    Join Date
    07-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Thanks again DILIPandey,

    Sorry for the need to 'dumb' it down for me...

    you start a 'new name'
    Name: "data"
    Scope: "sheet1"
    Comment:
    Referes to: "=OFFSET(?????,-5,0,11,1)"

    How have you gotten the formula to recognise which cell is active?

    Thanks again

    Nelg



    'reference' c

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Hi Nelg,

    How have you gotten the formula to recognise which cell is active?
    That cell can be seen in the name box above column A.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  7. #7
    Registered User
    Join Date
    07-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Thanks DILIPandey,

    Think I figured it out...

    it appears if i use the formula =OFFSET(SHEET1!A1,-5,0,11,1)

    'A1' references the 'entire sheet1' and the 'defining name' function knows which is the 'current cell'

    I can definately use your suggestion...MANY THANKS!

    Nelg

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    You are welcome .. !!

    Here Sheet1!A1 is the relative reference, hence when you move the conditional formatting, the reference will move.. you can say that it references the entire sheet 1 but it's actually not the case

    Request you to mark this thread as [SOLVED].

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    @ GlenNelg

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  10. #10
    Registered User
    Join Date
    07-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Hi All,

    I'm not sure if I can re-start a thread...my appologies if it's in the wrong list.

    The suggestion of using Cell Naming worked a treat, however I'm now trying to make it more complex...

    I'd like to SUM the previous 5 rows and/or until their is an empty cell.
    eg. if the formula encounters a blankcell 3 rows up, it only sums up until the blankrow
    any help would be greatly appreciated

    Cheers

    Nelg

  11. #11
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    Hi Nelg,


    This thread is solved and also your new questions does not justify the thread title (subject) of this.. hence I would suggest you to start a new thread. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  12. #12
    Registered User
    Join Date
    07-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Conditional Format to <sum current cell> + <5 cells above and below>

    ok, thanks

+ 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