+ Reply to Thread
Results 1 to 3 of 3

Sum data when considering several variables

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

    Lightbulb Sum data when considering several variables

    Hi there

    Have a spreadsheet whereby I need to calculate Pension on a salary, based on the source data meeting certain criteria.

    Spreadsheet attached. Worksheet name 'Staff Costs', source data 'Staff Data'.

    http://www.excelforum.com/attachment...1&d=1459353891

    Cell V16
    I've attempted to right a formula but it's not pulling in the desired value.

    What I would like:
    From 'Staff Data', I would like the formula to check:

    Employee cell T13 (Staff Costs), from column G (Staff Data)
    ABC cell T5 (Staff Costs), from column B (Staff Data)
    Check the employee has started via Staff Data column M (as we're looking at Jan-16) is equal to 1
    Start Date cell V5 (Staff Costs), from column I (Staff Data) - then add on 3 months which is when Pension cost becomes effective, assuming it's post Jan-16

    THEN,

    I would like the formula to return the sum of 'Salary x Pension %'

    Hope this makes sense

    Help if you can. I've spent a while on it with no luck

    Thanks, Maddy
    Attached Files Attached Files
    Last edited by overbomb; 03-31-2016 at 04:44 AM. Reason: Answer Provided

  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,178

    Re: Sum data when considering several variables

    Try

    =SUMPRODUCT(('Staff Data'!K3:$K$46)*('Staff Data'!B3:$B$46=$T$5)*('Staff Data'!G3:$G$46=$T$13)*('Staff Data'!M3:$M$46=1)*(DATE(YEAR('Staff Data'!$I$3:$I$46),MONTH('Staff Data'!$I$3:$I$46)+3,DAY('Staff Data'!$I$3:$I$46))<V$5)*('Staff Data'!M$3:M$46),('Staff Data'!$L$3:$L$46)/12)

    Above gives result of 440 which agrees with calculation using filtering (assuming I got that right!)

    In your original formula you had Salaries in twice.

    =SUMIFS('Staff Data'!K2:$K$46,'Staff Data'!B2:$B$46,$T$5,'Staff Data'!G2:$G$46,$T$13,'Staff Data'!M2:$M$46,1)*(DATE(YEAR('Staff Data'!$I$3:$I$46),MONTH('Staff Data'!$I$3:$I$46)+3,DAY('Staff Data'!$I$3:$I$46))<V$5)*('Staff Data'!$K$3:$K$46*'Staff Data'!M$3:M$46*'Staff Data'!$L$3:$L$46/12)

    Corrected .....

    =SUMIFS('Staff Data'!K2:$K$46,'Staff Data'!B2:$B$46,$T$5,'Staff Data'!G2:$G$46,$T$13,'Staff Data'!M2:$M$46,1)*(DATE(YEAR('Staff Data'!$I$3:$I$46),MONTH('Staff Data'!$I$3:$I$46)+3,DAY('Staff Data'!$I$3:$I$46))<V$5)*('Staff Data'!M$3:M$46*'Staff Data'!$L$3:$L$46/12)

    This now also returns 440
    Last edited by JohnTopley; 03-31-2016 at 03:44 AM.

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

    Re: Sum data when considering several variables

    Hi John,

    Thank you for taking the time to go through this for me - much appreciated.

    Worked perfectly

    Thanks, 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. [SOLVED] finding an output from 5 variables in an array using exterior input user variables
    By Allsort in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-09-2013, 11:16 AM
  2. VB Variables/Data Types
    By Doruli in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2012, 09:08 AM
  3. Replies: 3
    Last Post: 09-11-2012, 02:03 AM
  4. [SOLVED] Help to Chart Comparison Data of 2 sets of data with 5 variables each needed please
    By bluejasmine in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 05-13-2012, 12:45 PM
  5. Three variables in a set of data
    By GeographyStudent11 in forum Excel General
    Replies: 1
    Last Post: 11-12-2011, 04:04 PM
  6. macro that finds variables in one column and enters values if variables found
    By xln00b in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2010, 08:22 AM
  7. Unzip Code - Works without Variables, Breaks with Variables...
    By AdamParker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2009, 02:35 PM
  8. locate data with 2 variables
    By Martindelica in forum Excel General
    Replies: 8
    Last Post: 11-17-2007, 01:35 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