+ Reply to Thread
Results 1 to 22 of 22

REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

  1. #1
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Exclamation REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hello,

    I am having difficulty with a certain function. It is as follows: =SUM(OFFSET(INDIRECT("I"&U7),,,S8,1)). The idea is to sum all of the values in a range from the starting row (distinguished by cell U7) to the end row (distinguished by S8), across a single column (I). For some reason, this formula works perfectly when I apply it to about 30 cells or less, but gives me a reference error when I apply it to values greater than that. I have attached my worksheet, demonstrating this problem. Please see the following REF Errors in cells S2, T2 (They are mirrored in W2 and X2 but a solution to the former will apply just the same).

    For clarity, I have a string which details the amount of cells to observe, based on the total time (cells 012:014). Essentially, I record data at 240 fps, and therefore just 3-4 minutes of data donates tens of thousands of data points, which is necessary for my work. In order to easily manipulate the range of values analyzed by the S2 and T2 cells, please change the time values; they are in a custom format of mm:ss.00. Sheet 1 is my formulas working with 2 data points per interval (Although it works at 2400 data points per interval as well for some reason - does this have to do with equal intervals or something?) and sheet 2 is a closer realistic amount of data per interval (Although, again, I'm normally in the tens/hundreds of thousands) demonstrating no differences outside of my formulas (Just the INTERVALS) and depicting a REF error in ST and T2.

    Edit: The original file I posted lacked a working example of the formula in question. I have attached a new file (Example of formula working) demonstrating how the file can sometimes work, sometimes faulted. Please refer to this file. The ranges over which the formula should act are past the mark of the included data (excised due to submission limitations) but the theory remains the same. If you perform error tracing, Excel suggests my initial ranges in the formula are what is causing the error, independent of the data being retrieved (As evidenced by the value 0 in S2 vs #REF in T2).

    Please, if anyone could offer their assistance in this manner it would be genuinely appreciated!
    Thank you for your time.
    Attached Files Attached Files
    Last edited by SapphireZulu; 11-18-2020 at 01:55 PM. Reason: I am editing this to to include an excel file demonstrating the formula working in S2, but not T2. I have no idea why this occurs. Pls help

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    I think you are making life very complicated for yourself. However, this does not work:
    =SUM(OFFSET(INDIRECT("I"&U7),,,S8,1))

    because U7 and S8 are not integers. You have just formatted them to look like integers.

    Can you explain HOW you define the start and end points to help come up with something more sensible.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    If you want to SUM from I2 to I-something, XXX datapoints down, how do you calculate the value of XXX?

  4. #4
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hi Glenn,

    I define the number of data points down the column I by the time it took, in seconds, from frame point 1 (R6) to frame point 2 (R7) x 240 frames per second. In essence, it is the seconds per checkpoint x 240 frames. The number of frames details the number for cells I want to include, starting from each checkpoint (i.e. 1- 240 then 241-480 for example). Does this make sense? Thank you for your swift response!

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Maybe

    =ROUND(240*R12,0) in R7 copied down. R2 and S2 return zero for the SUM as the range of values doesn not go down as far as the starting point.
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Basically, your formula was saying start at cell U29.4 and sum down for 234.76 rows (or whatever... these numbers were just made up by me). To avoid "odd" results, it needs to have integers as inputs.

  7. #7
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    To be more specific, depending on the difference in time across two "Frame Points" (Which is just another way for me to say a Checkpoint), the time in seconds is calculated, then multiple by 240 to get the frame count (which is equal to the number of cells I want to go down the column "I"). I want to start going down at Cell I2 (based on the cell count calculated by the row O12:T12), adding the values in the specific number of cells calculated in this row. Then, I want to repeat this, starting from the cell directly after I stopped summing values from the previous "I2:Range". I calculate this amount using row O13:T13 (Referring to the difference from frame point 2 to 3, which is equal to Checkpoint 2). Because the length of each checkpoint is variable, and I can only multiply the time in seconds, I have this convoluted setup to extract the frame (cell) count, and I am attempting to apply it as a consecutive range to each portion of the "I" column, such that the summative values of each time range are calculated automatically, one after the other.

  8. #8
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hi Glenn,

    Sorry, I responded to this without seeing your latest message. I will try this and get right back to you. Thank you!

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    I understand now, I think. Have you noticed that the values in P12 to P14 are "out" by one second?

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Back in a few minutes with a better way.

  11. #11
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hi Glenn,

    Yes, I do see that. I am not sure why, perhaps it is because they are being rounded? Also, I tried to put in my data (50000 points) and calculate the values from S2 and T2 but I only see values of zero. Is this a formatting issue with he values being labelled as general vs number for example? Thank you

  12. #12
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Perhaps I can send you a few hundred/thousand data points to demonstrate what I am talking about. Unfortunately the size exceeds the limit for the forum post. If it would help, is there a way I might be able to send a larger file to you? Thank you

  13. #13
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    In the file with the name beginning with Example, cell S2 shows a #REF! error. The reason is that its formula uses INDIRECT("I"&T8), but T8 may display as an integer, but it evaluates to 31977.2. T31977.2 isn't a valid cell address. You need to use either ROUNDDOWN(T8,0) or ROUNDUP(T8,0).

    That said, you don't need to use INDIRECT. You could use =SUM(INDEX(I:I,T8):INDEX(I:I,T8+R9-2)) because INDEX expects its 2nd and subsequent arguments to be integers, it automatically discards the fractional part. Another benefit it that INDEX isn't volatile. Even if you want the perceived benefits of OFFSET, there's no reason whatsoever to use INDIRECT for this. Try

    =SUM(OFFSET(I1,T8-1,,R9-1,1))

    because OFFSET also expects 2nd and subsequent arguments to be integers and also discards fractional parts.
    Last edited by hrlngrv; 11-18-2020 at 02:41 PM. Reason: addendum

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    HRLN may have answered this. But this is what i had in mind.

    See sheet.

    R6, to give the formula a starting point
    1

    R7, copied down:
    =1+ROUND((Q7-Q6)*86400*240,0)

    to provide an end point.

    S7, copied down:
    =SUM(INDEX($I$2:$I$100000,R6,):INDEX($I$2:$I$100000,R7,))

    The total at S8 is incomplete and s9 and s10 are blank as the dataset is not long enough. Try it out on a bigger dataset and let me know how it goes.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hi hringrv,

    Thank you for your response. I will try this now and be back in a flash.

  16. #16
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hi Glenn,

    I will also try this and get back to you asap. Thank you!

  17. #17
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hi Everyone,

    Both solutions work perfectly. Thank you very much for your expertise. My last question, a very simple one, would be in reference to what you pointed out earlier Glenn. In cells N12:N14 the seconds function is rounded up. Given that I am adding the decimal independently, would you happen to know how I might round down the value instead, such that my additions are correct? Your earlier formula takes that into account Glenn, but I would like to retain my current structure, and am also curious in general. I am aware of the round down function, but am ignorant as to how I use it with =Seconds... Excuse me. Thank you both, once again.
    Last edited by SapphireZulu; 11-18-2020 at 03:02 PM. Reason: Spelling error

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Try =ROUND(formula,0)

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  19. #19
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    Hi Glenn,

    I will check out your suggestion and make sure to add reputation for you both as well as mark this as solved.
    Following your comment, I have two more questions (my apologies). I believe this should be an easy Index function, but I am more familiar with offset. Might you have a suggestion for how I can simply formulate (Sum from cell I2 : I (value from T7) using Index? This function refers to the information in cell Q2. I would also like to do the same for cell Q1, but it would refer to the following (Sum from cell I2 : I (Value from S9).
    Lastly, the equation you suggested, Glenn, for rounding down the seconds does not work for decimals above .5 (It rounds up). I tried employing the Rounddown function but it also seems to fail for some reason. May I ask for any suggestions?

    The relevant cells in question have been highlighted in red. The yellow highlighted cells are irrelevant.

    Thank you.
    Attached Files Attached Files

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    can I suggest that you GET familiar with INDEX. OFFSET is useful, but it is volatile. It recalculates EVERY tiem ANYTHING changes ANYWHERE on your worksheet. In a big file, that can cause severe performance issues.

    Might you have a suggestion for how I can simply formulate (Sum from cell I2 : I (value from T7) using Index?
    Yes. Use the formula I suggested in my last post. That is EXACTLY what it does.

    I tried employing the Rounddown function but it also seems to fail for some reason. May I ask for any suggestions
    =INT(O13*86400)

  21. #21
    Registered User
    Join Date
    11-18-2020
    Location
    Nicaragua
    MS-Off Ver
    EXCEL V16.39
    Posts
    21

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    My apologies Glenn,

    As I mentioned, I find the functions of Index to be somewhat difficult. I attempted to map your function to that of I2 : (value from T7) but was unable to do so. Therefore, I thought I would ask.
    Thank you for your help.

  22. #22
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,969

    Re: REF ERROR: Sum, Offset and Indirect functions to map sum alternating ranges of values

    INDEX is simple.

    =INDEX(Range,Row Number,Column Number) If you have a range I2:I100 and a row number of 1, it will return the first value in that range (I2), with 2, it will return I3, and so on. If the range is all in one column, you don't need to add the the column number.

+ 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: 5
    Last Post: 05-18-2016, 04:50 AM
  2. Replies: 4
    Last Post: 04-02-2016, 07:12 AM
  3. Offset and Indirect with Dynamic Named Ranges
    By nickmangan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-07-2014, 10:42 PM
  4. [SOLVED] INDIRECT Functions and Date Ranges
    By DSwartz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2013, 12:31 PM
  5. [SOLVED] Combining IF, OFFSET and INDIRECT functions.
    By dowell89 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-30-2013, 05:50 AM
  6. [SOLVED] Combining OFFSET, Indirect and IF functions
    By dowell89 in forum Excel General
    Replies: 3
    Last Post: 10-25-2013, 06:20 AM
  7. Error while using loop and offset functions
    By Fei.R in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-19-2012, 10:57 PM

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.6.0 RC 1