+ Reply to Thread
Results 1 to 5 of 5

Using SUMIF and OFFSET togeather

  1. #1
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Unhappy Using SUMIF and OFFSET togeather

    Hi Guys,

    I have used the following formula to SUM column "I", I have used the OFFSET function because we have to insert new rows, I read that using the OFFSET if I inserted, say, 3 rows the I20 would change to I23, and it does, it works fine.

    SUM(I6:OFFSET(I20,-1,0))

    Now, I have a column "C" that store names and I used the SUMIF function to get a total,

    =SUMIF(C6:C20,"Silver Dawn",I6:I20) this also works fine until I insert new rows.

    So I have tried a combination of both the SUMIF & OFFSET functions, like

    =IF(C6:OFFSET(C20,-1,"SilverDawn"),I6:OFFSET(I20,-1,0))

    Can this be achieved, can the 2 functions be used together, if so can you help with the syntax?

    TIA
    Keith

    ps
    Sorry if this post appears twice, I "thought" I posted it a couple of hours ago but there was no trace of it so I wrote it again

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Using SUMIF and OFFSET togeather

    Hi,

    When you insert new rows, what do you want the formula:

    =SUMIF(C6:C20,"Silver Dawn",I6:I20)

    to become?

    Say you insert one new row at, e.g row 8. Over what range would you like this formula to now calculate? (Row 20 will currently change to row 21 in that example.)

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Using SUMIF and OFFSET togeather

    hi Keith. there seems to be a few confusion:
    1. your formula =OFFSET(I20,-1,0) actually ranges up I19. but you wanted I6:I20 right?
    2. if you insert rows without the OFFSET formula, the range will increase too. if you insert 3 rows before I6, it will become I9:I23. if you insert in between, it becomes, I6:I23. so tell us where are you inserting the rows and what do you expect the formula to look like after inserting. for eg. if the original formula is:
    =SUMIF(C6:C20,"Silver Dawn",I6:I20)
    3. could you update your profile of your MS Off Ver. it would be clearer & help members give you newer & more efficient formulas?

    edit: point 2 like what XOR_LX asked

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Re: Using SUMIF and OFFSET togeather

    Ok Guys,

    First of all thank you for your responses and sorry for the confusion.

    I have updated my profile to say I am using Office 2010.

    The row numbers were hypothetical in my post, so I'll try to explain.

    I have a button on the sheet that, when clicked, adds an additional 6 rows with all formatting/calculations and inserts these rows above the row that contains my SUMs.

    1. your formula =OFFSET(I20,-1,0) actually ranges up I19. but you wanted I6:I20 right?

    In this example the SUM(I6:I20) is the TOTAL which is in I20. If I press the button the OFFSET(I20,-1,0) should then read OFFSET(I26,-1,0) hit the button again and it should read OFFSET(I32,-1,0) as I said in my post, this is working fine in columns F through to X. It is in column AA I am having the problem, where I am trying to use the SUMIF and the OFFSET together.

  5. #5
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Using SUMIF and OFFSET togeather

    You may try:

    =SUMIF(C6:OFFSET(C20,-1,0),"SilverDawn",I6:OFFSET(I20,-1,0))
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  6. #6
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Re: Using SUMIF and OFFSET togeather

    Hi Izandol,

    Thank you for your input the calc you posted (once I put a space between Silver & Dawn) worked perfectly.

    =SUMIF(C6:OFFSET(C20,-1,0),"Silver Dawn",I6:OFFSET(I20,-1,0))

    Strangely so does

    SUMIF(C6:C20,"Silver Dawn",I6:I20) but I HAD to include the row I20 which is where the actual SUM is.

    I would like to thank all who helped.

+ 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. two worksheets working togeather
    By codeformat in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2014, 08:54 PM
  2. CountIF and Hlook Up Togeather
    By sreeni85 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-20-2014, 01:30 PM
  3. how to use find and left togeather
    By nuruedriss in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-01-2013, 06:51 AM
  4. linking 2 work books togeather
    By Zealotwraith in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-02-2013, 11:01 AM
  5. Using sumproduct and subtotal togeather ???????
    By LondonM in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-19-2013, 10:59 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