+ Reply to Thread
Results 1 to 4 of 4

Summing based on multiple conditions

  1. #1
    Registered User
    Join Date
    02-11-2021
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    8

    Summing based on multiple conditions

    Hi there,

    I am looking to create a workbook that shows a total count of hours where workers have been moved.

    There are multiple units within an area and the same one unit can be defined within multiple areas.

    e.g. Unit 0101 is in Area10 and Area16.

    The Workbook contains a mock 'front end' and the other sheets are the month totals that are populated through an export from an Access database.

    I am looking to create a loop to iterate all month sheets but as an example I will only describe one month. The process is as follows:

    Look at Month1 sheet and get the first unit, then check what areas this unit is in (Adjusted Hours.Range(AB:AB)) and then accumulate the hours associated with that unit to all relevant area totals for that month.

    Therefore from the data:
    Hours Unit
    -9 0101
    3 1101
    6 1201
    -12 1707
    4 7777

    Would result in:

    Area Hours
    Area 1 3
    Area 2 6
    Area 4 -12
    Area 10 -9
    Area 14 4
    Area 16 -9
    Area 19 4

    I have made an attempt at this (see attached example doc) but I could not manage to sum the relevant information.t

    I have tried to comment as best I could to describe what i have done/expect to happen.

    Any time spent on this would be greatly appreciated!

    Thanks,
    Greg
    Attached Files Attached Files
    Last edited by gregwinter; 04-29-2021 at 09:40 AM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,168

    Re: Summing based on multiple conditions

    Hey Greg

    1. Fix your Unit entries-inconsistent...Some are stored as text, others as a number...I corrected this...
    2. Rename your sheets to Mar, Apr, May
    3. Inserted Area in all blanks of AA:BB lookup table

    Then this will work...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    02-11-2021
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Summing based on multiple conditions

    Hi sintek,

    This works like a charm.

    Your solution is also very tidy compared to my original attempt.

    Thanks very much for your time and effort

    Cheers,
    Greg

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,168

    Re: Summing based on multiple conditions

    ..........................
    Thanks.png

+ 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] User Defined Function for Summing a range based on multiple conditions
    By judeprem in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-29-2020, 03:39 AM
  2. Summing numbers based on multiple conditions across a range
    By docstew in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-02-2018, 04:05 PM
  3. [SOLVED] Summing values in cells based on multiple conditions
    By OregonSenior in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-28-2014, 06:58 PM
  4. [SOLVED] Summing based on conditions
    By hqureshi78 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-15-2013, 12:50 PM
  5. Summing based on several conditions
    By aiwnjoo in forum Excel General
    Replies: 14
    Last Post: 08-05-2010, 09:01 AM
  6. Summing based on multiple conditions
    By confu5ion in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 02-11-2010, 06:14 PM
  7. Summing Based on Conditions
    By John Bates in forum Excel General
    Replies: 4
    Last Post: 09-08-2009, 02:43 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