+ Reply to Thread
Results 1 to 10 of 10

Date Based SumIf Criteria

  1. #1
    Registered User
    Join Date
    03-09-2012
    Location
    N/A
    MS-Off Ver
    MS 365
    Posts
    70

    Date Based SumIf Criteria

    Workbook - Pensions Calc.xlsx

    Hi

    This is an inherited spread sheet and I've spotted a flaw that I'm not sure how to correct

    Attached spread sheet has two tabs, Staff Data, Staff Costs

    Staff Data lists Current Employees, date started etc and 'Pension' Contribution %

    The Staff Costs tab has some formula in it which sums up Staff Data

    Employees are only enrolled in the company Pension after completing 3 month probation period, therefore I need a formula that calculates from start date (col F) to insure it either falls prior to the month OR 3 month after in the relevant yr, i.e. 2014, e.g. All current employees who started 3 months before Jan-14 are entitled to Pension, any new employees will be entitled to the Pension 3 months from their start date

    Any help would be grateful

    Many thanks, Maddy

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Date Based SumIf Criteria

    If I get hired on 5/15, does my entitlement to benefits begin in August or October?

    (3 month anniversary would be 8/15, just clarifying calculation)

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Date Based SumIf Criteria

    Maybe change you date range calculation to include the 3 months:

    =IF(AND(L$1>=DATE(YEAR($F3),MONTH($F3)+3,DAY($F3)),L$1<$G3),$C3,IF(AND(MONTH(L$1)&YEAR(L$1)=MONTH($F3)+3&YEAR($F3),L$1<$G3),$C3*1-((DAY($F3)-1)/DAY(EOMONTH(L$1,0))),0))

  4. #4
    Registered User
    Join Date
    03-09-2012
    Location
    N/A
    MS-Off Ver
    MS 365
    Posts
    70

    Re: Date Based SumIf Criteria

    it would probably roll to October, but yea from a formula point of view it would be 8/15

    will try out your calc below

    sorry for late reply

    Thanks, Maddy

  5. #5
    Registered User
    Join Date
    03-09-2012
    Location
    N/A
    MS-Off Ver
    MS 365
    Posts
    70

    Re: Date Based SumIf Criteria

    Thank you for your help with the formula above

    However, I think I should have explained more clearly. It is the Formula Calc in 'Staff Costs' tab that requires amending to pull through the variant of +3 months

    e.g. Cell D12 in 'Staff Costs' tab needs to be amended for the +3 months where applicable

    I've tried using the one above but can't get it to work through

    Your help is appreciated

    Thanks, Maddy

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Date Based SumIf Criteria

    Oh okay. I wrote the above formula because it looked like there was an error in the formulas for L3:W39.

    The employees with a start date of 1/2/2014 are showing as having benefits as of 2/1/2014. The formula I wrote corrects the issue by only giving benefits at the 3 months +.

    Correctly assigning benefits on the front page eliminates the need to change the formulas on the back page.

  7. #7
    Registered User
    Join Date
    03-09-2012
    Location
    N/A
    MS-Off Ver
    MS 365
    Posts
    70

    Re: Date Based SumIf Criteria

    I think we are still at cross purposes

    The 1 in those cells acts as a 'count' for FTE and Headcount numbers, therefore that formula does not need to change as to have a '1' in the start month is accurate. However, in cell D12 (for example) on the 'Staff Costs' tab, I need the formula to change so that when it calculates an amount it considers that it's 'start date' + 3 months

    Does that make sense?

    Many thanks, Maddy

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Date Based SumIf Criteria

    Indeed it does. I'm a Workforce Analyst and I'm all too familiar with the almighty FTE.

    I'm a little lost on D12 though. No idea what NI means. Did you mean D13 where the Pension is listed?


    Found a few things so far as I work through the rest of it. You can tell some of the formulas have been adapted from previous versions of Excel.

    A lot of the arrays can be simplified into non-array formulas. Array formulas can do some amazing things, but should be avoided in great number as they can increase processing time and file size.

    • The SUM(IF( arrays that contain no products within the IF can be converted to standard SUMIFs.

    =+(D19-('Staff Data'!$C$47*SUM(IF('Staff Data'!$D$2:$D$40='Staff Costs'!$B$18,'Staff Data'!L$2:L$40,0))))*'Staff Data'!$C$46

    becomes

    =+(D19-('Staff Data'!$C$47*SUMIF('Staff Data'!$D$2:$D$40,'Staff Costs'!$B$18,'Staff Data'!L$2:L$40)))*'Staff Data'!$C$46

    • The SUM(IF( array formulas that contain products can be changed to SUMPRODUCT.

    =SUM(IF('Staff Data'!$D$2:$D$40='Staff Costs'!$B$26,'Staff Data'!L$2:L$40*'Staff Data'!$J$2:$J$40)/12)

    becomes

    =SUMPRODUCT(('Staff Data'!$D$2:$D$40='Staff Costs'!$B$26)*('Staff Data'!L$2:L$40*'Staff Data'!$J$2:$J$40)/12))
    Last edited by daffodil11; 10-23-2013 at 12:28 PM. Reason: stuff

  9. #9
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Date Based SumIf Criteria

    I think I just about have it. The arrays in lines 21, 29, 37 etc should total Pension as such:

    =SUMPRODUCT(('Staff Data'!$D$2:$D$40='Staff Costs'!$B$18)*(DATE(YEAR('Staff Data'!$F$2:$F$40),MONTH('Staff Data'!$F$2:$F$40)+3,DAY('Staff Data'!$F$2:$F$40))<D$6)*('Staff Data'!$H$2:$H$40*'Staff Data'!L$2:L$40*'Staff Data'!$I$2:$I$40/12))

    With the bold reference changing depending on the job title.

    This statement says:

    Give me the sum of these criteria:
    All lines that match job title
    Of those lines that match, all lines whose hire dates plus three months are less than month header
    Of those lines that match, Salaries * FTE * Pension% ÷ 12

    The overall totals in 9:16 can stay as they are.

  10. #10
    Registered User
    Join Date
    03-09-2012
    Location
    N/A
    MS-Off Ver
    MS 365
    Posts
    70

    Re: Date Based SumIf Criteria

    hello there

    Thank you for persevering with this for me

    I've worked it through the templates and it's working perfectly

    and yes, it was cell D13 as the total feeding of the others you mentioned - be helpful if I gave the proper cell references..

    Thanks again, Maddy

+ 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. Sumif Based on matching date criteria
    By krunk in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-18-2013, 11:19 AM
  2. SUMIF based on multiple date criteria
    By titantough in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-13-2011, 02:54 PM
  3. Sumif based on a text criteria and a date range
    By PiR1 in forum Excel General
    Replies: 2
    Last Post: 06-02-2010, 12:53 AM
  4. SumIf using date criteria range and one other criteria
    By DJTMONEY in forum Excel General
    Replies: 1
    Last Post: 04-20-2010, 04:10 PM
  5. SumIf based on two criteria
    By Mark Williams in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 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