+ Reply to Thread
Results 1 to 4 of 4

Offset range and Sum formula

  1. #1
    Registered User
    Join Date
    04-18-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    49

    Offset range and Sum formula

    Hi,


    I need a line of code that would do the following:

    Please Login or Register  to view this content.
    I need to add:
    if Sum (f.Offset(,-1):f.Offset(,-23)) = 0 or is blank then f.Interior. Color= RGB(100,100,100)
    But Then I need it to go to the next column to the right and do it as many times as there are columns in the spreadsheet
    Would really appreciate your help!
    Thanks!

  2. #2
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Offset range and Sum formula

    Hi Aquamore,

    Can you post the file for an example?

    Your range is 'Z1:Z100', any OFFSET with a negative will either go to the left of the selected Cell or above it.

    A before & after example would be good.

    Cheers
    Remember you are unique, like everyone else

  3. #3
    Forum Contributor
    Join Date
    07-29-2014
    Location
    Oz
    MS-Off Ver
    2010
    Posts
    142

    Re: Offset range and Sum formula

    Assuming your data is on sheet 1:

    Please Login or Register  to view this content.
    Dan
    Don't forget to ☆ me if I helped you!

  4. #4
    Registered User
    Join Date
    04-18-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Offset range and Sum formula

    Noboffinme, thanks for looking!
    Danerida, you rock!
    The only thing- "Exit For" would not work for me I changed it to

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-29-2014
    Location
    Oz
    MS-Off Ver
    2010
    Posts
    142

    Re: Offset range and Sum formula

    Strange, it worked for me.

    Did you mean to put Next_Cell: in the outer loop (just before Next i)? If you leave it in the inner loop, it will continue even if the cells in the current range are blank. Checking for the Null string was intended to stop the macro shading blank cells for no reason and wasting time.

    Glad to help.

  6. #6
    Forum Contributor
    Join Date
    07-29-2014
    Location
    Oz
    MS-Off Ver
    2010
    Posts
    142

    Re: Offset range and Sum formula

    Strange, it worked for me.

    Did you mean to put Next_Cell: in the outer loop (just before Next i)? If you leave it in the inner loop, it will continue even if the cells in the current range are blank. Checking for the Null string was intended to stop the macro shading blank cells for no reason and wasting time.

    Glad to help.

+ 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: 1
    Last Post: 01-23-2013, 03:00 PM
  2. Replies: 0
    Last Post: 06-19-2012, 05:15 PM
  3. Offset/Match formula - range limited
    By locapacow in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-13-2007, 10:29 AM
  4. Replies: 5
    Last Post: 07-28-2006, 01:00 PM
  5. Using Offset to determine Column range in Array formula
    By downforce in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-25-2005, 12:13 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