+ Reply to Thread
Results 1 to 8 of 8

Add using variable criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    01-03-2009
    Location
    Atlanta GA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Add using variable criteria

    \1

    ok so i realized i did not include the Letter and number portions of excel so just assume A,B,C..... 1,2,3 .... ect.

    so what i need to do is Add the hours and Overtime Hours of all jobs with the same Job # together. the way i have this set up the job numbers only appear when that job is listed as having over time. the reason it lists regular hours as well is so the accountant will know if all of that day was in over time ,.... or if there are more hours in overtime than hours on that contract it means they worked time in the warehouse as well.

    so i have tried working with sumproduct and sum if ,... but all the examples say the criteria is liike " Pen" or something like that ,..... but the job #'s are alwayse changing ,.... how can i tell it to specify a value in a cell and add the next "Bcollumn" of any ACollumn's" that match?
    Last edited by DPaul; 07-27-2010 at 12:53 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sumif ? trying to add using a variable criteria...

    You can create formulas that display the unique values in column B in a list. Then standard SUMIF() formulas on those values can be used.

    Are Job numbers ALWAYS numerical? If so, that makes the list very easy to create.

    Click GO ADVANCED and use the paperclip icon to post an actual workbook. Make sure there is sample data and mockup the desired results from that sample data completely, we'll help you turn that into formulas.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-03-2009
    Location
    Atlanta GA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Add using variable criteria

    this is what iv got so far
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add using variable criteria

    Like so...

    The array formula in U4 would be:
    =INDEX($L$4:$L$10, MATCH(0,COUNTIF($L$4:$L$10,"<"&$L$4:$L$10),0))
    ...confirmed by pressing CTRL-SHIFT-ENTER. A zero should appear.

    The array formula in U5 would be:
    =IF(COUNTIF($L$4:$L$10,">"&U4), INDEX($L$4:$L$10, MATCH(COUNTIF($L$4:$L$10,"<="&U4), COUNTIF($L$4:$L$10,"<"&$L$4:$L$10),0)),"")
    ...confirmed by pressing CTRL-SHIFT-ENTER, then copy that cell down through U10.

    The normal formula in V5 would be:
    =IF($U5="","",SUMIF($L$4:$L$10, $U5, M$4:M$10))

    Copy that down and across through W10.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-03-2009
    Location
    Atlanta GA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Add using variable criteria

    Thats amazing ! thank you sooo much ,.... i will look this over now and see if there are an other things the accountant needs. TYVM

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add using variable criteria

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  7. #7
    Registered User
    Join Date
    01-03-2009
    Location
    Atlanta GA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Add using variable criteria

    now each employee will have a block like this ,... but when i copy past to duplicate it the new code dosent transfer as normal formulas would ,... is there a trick to copy paste when arrays are in the formula?

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add using variable criteria

    The arrays will have to be constructed anew in the new location referring to the new ranges. Array formulas are powerful, but a bit of a pain to use.

    Remember, the first formula stands alone. Then the second formula can be constructed then copied down to continue the list.

    BTW, array formulas can be a performance drain, too. Be wary of constructing formulas that apply to HUGE ranges, and also be wary of putting tons of these formula in a single spreadsheet. You'll see what I mean about performance if you start to do either one of those things.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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