+ Reply to Thread
Results 1 to 10 of 10

SUMIF: don't understand that purpose of the OFFSET inside SUMIF

  1. #1
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    Hello!

    Please, take a look at the attached file.
    I am referring to the SUMIF formula used throughout the column K.

    The formula in K10 cell:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I will try now to show how I understand it, and I will be grateful if you correct me and explain my mistakes.

    (1)
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    is the range to look at.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    means start at A10 and don't move anywhere (0,0), take only this A4 value (one row, one column).

    But I don't understand the combination
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    used here.
    In any other circumstance I would read this as:
    start at A3 and move all the way down to A10 , taking into account all values in each cell A4, A5, A6, etc.

    But when I click on the formula I see that only A3 and A10 are highlighted. I assume that this means that the formula looks in each cell from the cell A3 to the cell A10 looking for a value specified in the second argument of the SUMIF function, is it correct?

    (2)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I am a bit confused by this syntax, but I assume it means that the criteria is the value in A10. How to correctly read this syntax?

    If these above assumptions are correct, then why don't they simply use A10 as a value, and subsequently J10, without using OFFSETS and ranges A$3:OFFSET(A10,0,0,1,1) and J$3:OFFSET(J10,0,0,1,1). What value does this syntax add compared to simply referring to one cell?

    Thank you very much!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    The formula in K4 could be replaced by ..

    =SUMIFS($J$4:J4,$A$4:A4,A4)-SUMIFS($I$4:I4,$A$4:A4,A4)

    Put above in M4 and drag down

    Does this make it easier to understand?

    Basically we are checking a/c type in column A and subtracting column I from column J: the SUMIFS increment each time we find a match.

  3. #3
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    Quote Originally Posted by JohnTopley View Post
    The formula in K4 could be replaced by ..

    =SUMIFS($J$4:J4,$A$4:A4,A4)-SUMIFS($I$4:I4,$A$4:A4,A4)

    Put above in M4 and drag down

    Does this make it easier to understand?

    Basically we are checking a/c type in column A and subtracting column I from column J: the SUMIFS increment each time we find a match.
    Thank you very much for your reply. But unfortunately this did help me to understand my questions. I understand the main idea about what we do with this formula, i.e. subtracting I from J, but I am curious about syntax nuances, and how that works.

  4. #4
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    looks like disimproving.
    This is more useful
    Accounts!F19=SUM(F6:OFFSET(F19,-1,)), and no need ◄ Insert new rows above this one to add accounts

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    All of the OFFSETS simple reference the first range:

    OFFSET(A5,0,0,1,1) references A5


    This one simply references the previous row

    OFFSET(L4,-1,0,1,1)+J4-I4) i.e L3

    No idea why these are used as they serve no useful purpose

  6. #6
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    Quote Originally Posted by JohnTopley View Post
    All of the OFFSETS simple reference the first range:

    OFFSET(A5,0,0,1,1) references A5


    This one simply references the previous row

    OFFSET(L4,-1,0,1,1)+J4-I4) i.e L3

    No idea why these are used as they serve no useful purpose
    I see. Thank you very much. You sort of confirmed my assumption, because I also didn't see the purpose of these OFFSETS, but being a newbie I decided to ask here.
    One more question, if I may. Please, explain a bit more why we use this syntax $J$4:J4 (or $A$4:A4) in

    =SUMIFS($J$4:J4,$A$4:A4,A4)-SUMIFS($I$4:I4,$A$4:A4,A4)

    Thank you!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    If you drag the formula down, watch how those references change. This should answer the question, but if not, the fixed reference ($A$4) remains constant whilst the other (A4) increments as you drag down, so you are constantly extending the array.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    Quote Originally Posted by AliGW View Post
    If you drag the formula down, watch how those references change. This should answer the question, but if not, the fixed reference ($A$4) remains constant whilst the other (A4) increments as you drag down, so you are constantly extending the array.
    Thank you for your answer. This is embarrassing. I have asked the wrong question, I am sorry. But as I did, I have found the answer to my real question, which is also embarrassing, but anyways I learned a lot. I didn't understand why we need to take ranges of A column, but now I see that the =SUMIFS($J$4:J4,$A$4:A4,A4)-SUMIFS($I$4:I4,$A$4:A4,A4) gives the balance of only a specific name, given in each cell in the column A.

    The formula suggested by JohnTopley is a much more clear one.

    Still, I will be grateful for explanation of one still unclear part of the original formula, namely:

    what does syntax "="&A10 mean, and how it works. I understand that its purpose is to find A10 value in the given range A$3:OFFSET(A10,0,0,1,1) , but I don't understand the syntax.

    Thank you very much!
    Last edited by Vitalite; 06-30-2017 at 02:56 AM.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    "="&A10

    the "&" acts as a concatenate (join) function:

    so if cell A10="Credit"

    then the above translates to "=Credit"

    This allows the use of variables (A10)to hold the "match" value rather than "hard-coding" the value

    If we put "=A10" this means the value is literally "A10" as opposed to the cell A10.

    Another example: both the formulae below do the same i.e. check if column B contains "X" then SUMS the value in column C

    =SUMIF(B:B,"=X",C:C)

    =SUMIF(B:B,"=" &"X",C:C)

    Hope this helps

  10. #10
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: SUMIF: don't understand that purpose of the OFFSET inside SUMIF

    Quote Originally Posted by JohnTopley View Post
    "="&A10

    the "&" acts as a concatenate (join) function:

    so if cell A10="Credit"

    then the above translates to "=Credit"

    This allows the use of variables (A10)to hold the "match" value rather than "hard-coding" the value

    If we put "=A10" this means the value is literally "A10" as opposed to the cell A10.

    Another example: both the formulae below do the same i.e. check if column B contains "X" then SUMS the value in column C

    =SUMIF(B:B,"=X",C:C)

    =SUMIF(B:B,"=" &"X",C:C)

    Hope this helps
    Thank you very much! It is absolutely clear now. :-)

+ 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. [SOLVED] Shorten SUMIF + SUMIF + SUMIF each with same reference range but different criteria???
    By HeyInKy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-13-2014, 09:25 PM
  2. 'And' nested inside 'sumif'
    By ekirwa2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2013, 02:24 PM
  3. Array inside the SUMIF problem
    By AHB10 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-12-2013, 10:10 AM
  4. [SOLVED] a concatenate function inside of a sumif
    By Aguhr in forum Excel General
    Replies: 4
    Last Post: 09-20-2012, 11:33 AM
  5. [SOLVED] sumif inside a sumproduct!!
    By ratkiller in forum Excel General
    Replies: 3
    Last Post: 05-02-2012, 09:23 AM
  6. Can I use a Reference inside a SUMIF or COUNTIF Function?
    By Albie in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-13-2005, 06:25 PM
  7. [SOLVED] Date Format Inside of a SUMIF Statement
    By Aladin Akyurek in forum Excel Formulas & Functions
    Replies: 36
    Last Post: 09-06-2005, 07:05 AM

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