+ Reply to Thread
Results 1 to 16 of 16

How to best use sumif and if function

  1. #1
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    How to best use sumif and if function

    10 10 xxx
    12 10
    12 10
    10 10
    10
    10
    10
    10
    10
    10
    10
    10
    10
    10
    10
    In the above table I want to return a value. (xxx)Column A1 (value of 10) is used to count 10 occurances of column b. When i get to a2 i want it to add 12 occurances of column b. So in the first example it retrns a value of 100 and in the case of a2(12) a value of 120 in c2.I could do this with using the if function but is there a better way?
    Last edited by NBVC; 05-10-2011 at 09:21 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: How to best use sumif and if function

    Write in C1 =A1*B1

  3. #3
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to best use sumif and if function

    hi not quite what i want ..my fault as the columns seem to have moved when i copied them across.



    a b c
    1 10 10 xxx(100)
    2 12 10 yyy(120)
    10
    10
    10
    10
    10
    10
    10
    10
    10
    10

    I am looking to add the values of column b by the value in a1. the numbers in b are illustrative and will be different. i will want to change a1 to maybe 12 and without changing the formula calculte c1 based on adding up 12 occurences of co, b. If it helps its to work out inventory values based on forward weeks sales , where colb =sales cola is the weeks of forward stock to cover those sales and colc is the value of that stock based on the weeks weeks cover and sales. I could do it using "if" function but its a real pain.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to best use sumif and if function

    Do you mean?

    =SUM(B1:INDEX(B:B,A1)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to best use sumif and if function

    Thanks but not delivering the right answer. The data seems to have moved over a column for some reason when posted.Just to confirm how it should look a1 is variable in the example its 10 but could be anything. (and i would be entering a variable in a2,a3 etc to perform the same calculation. Column b is a column of 10's and c1 is the returned value. So working it through if i enter a 10 in a1 c1 should =100 and if i put a 12 in it should be 120.

    Hope that is clearer. Index did not solve this

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to best use sumif and if function

    Why not post a sample sheet? Probably would have avoided unnecessary loss of time

  7. #7
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to best use sumif and if function

    How do I do that?

  8. #8
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to best use sumif and if function

    Edit your OP - Click Go Advanced - Click the paperclip and follow the wizard ( for more info see the FAQ)

  9. #9
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to best use sumif and if function

    Hi here you go attached file as requested
    Attached Images Attached Images

  10. #10
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to best use sumif and if function

    Sorry, I meant a spreadsheet, not a picture

  11. #11
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to best use sumif and if function

    here you go
    Attached Files Attached Files

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to best use sumif and if function

    So this formula doesn't work?

    =SUM(C6:INDEX(C:C,B6+5))

  13. #13
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to best use sumif and if function

    no it does not work. It works for D6 but needs to work down the column and thats my issue. So as an example in week 2, 10 weeks stock based on 10 weeks of sales at 10k should be 100, your formula gives 90.(d7) Then 80,70

    Thanks for trying

  14. #14
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to best use sumif and if function

    Ok, how about?

    =SUM(C6:INDEX(C:C,ROW()+B6-1))

  15. #15
    Registered User
    Join Date
    05-09-2011
    Location
    St Albans
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to best use sumif and if function

    brilliant thanks so much. Not sure why it works but it does

  16. #16
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to best use sumif and if function

    Quote Originally Posted by LEGINXX View Post
    brilliant thanks so much. Not sure why it works but it does

    If you use the Evaluate Formula functionality, you will see how it works

+ 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