Results 1 to 6 of 6
  1. #1
    Bseb is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2014
    Posts
    3

    How can I calculate the sum of multiple elements when they have different values ?

    Hey! Bit new. Sorry if the title seems vague, I don't know how to better phrase it.



    I wanted to ask if I can make a field that shows me the sum of a+b+...+n just by inputting the number of variables in another field.

    Like I have a field: NumberOfEmployees
    And another: TotalValue

    If every employee has a different value atributed to them, what method would be used or what formula would I use in the TotalValue field to calculate the value based on the NumberOfEmployees field ?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    That makes no sense to me.

    Show example of raw data and the desired output.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Bseb is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2014
    Posts
    3
    Ok, let me try and explain. I have a form. The form has 2 fields: NumberOfEmployees and Value

    employee number: 1 | 2 | 3 | 4 | 5 | 6
    Value($): 10 | 25 | 50 |100 |170 |280

    I need to calculate the sum of Value by imputing the number of employees. So if I put in a specific field the nr. 3, then it would calculate in another field the sum of 10+25+50 and output a result

    Did manage to be more specific ?

    edit: Oh wow, the formating of the post does not help my case at all...

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    More post formatting tools in the Advanced editor.

    Still confused. What happens to 100, 170, 280 values?

    If you want to limit the calc to just 3 records, need some filter criteria.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Bseb is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2014
    Posts
    3
    Nono, the calculating 3 records was just an example. I need it to return the sum of the records that I input in my number field. If I put 4, it will calculate the first 4 records, if I put 10, it will calculate the first 10 records, etc.

    I just don't know the formula to make the program calculate the total records from a to n if I input n.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What do you mean by 'input in my number field' - is this an unbound textbox on form for input of criteria? Because inputting this into a field of table is not useful.

    Do an aggregate GROUP BY query with whatever criteria is used to limit dataset.

    Can use TOP N parameter to limit query to a specified number of records, otherwise need some kind of filter criteria.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DB Elements size
    By Christian1977 in forum Access
    Replies: 16
    Last Post: 06-13-2013, 10:36 PM
  2. VB to calculate count of distinct values
    By gokul1242 in forum Programming
    Replies: 1
    Last Post: 10-03-2012, 01:38 PM
  3. Hide elements of Pivot-table
    By ivancp in forum Access
    Replies: 0
    Last Post: 01-26-2011, 08:17 PM
  4. Calculate Multiple Fields for Extended Price
    By SRessler in forum Queries
    Replies: 3
    Last Post: 11-01-2010, 03:57 PM
  5. Table elements being replaced
    By HurrMark in forum Forms
    Replies: 0
    Last Post: 09-15-2008, 07:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums