How to count values from different records/data set.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnx1980
    New Member
    • Oct 2016
    • 3

    How to count values from different records/data set.

    Hi there,

    i got a question on how to plus/minus 2 values from the same column but from different records.

    how can i add the value "A" and the value "B" via queries or table (if that is possible)?
    Attached Files
  • PhilOfWalton
    Recognized Expert Top Contributor
    • Mar 2016
    • 1430

    #2
    How are you defining A & B?

    Phil

    Comment

    • johnx1980
      New Member
      • Oct 2016
      • 3

      #3
      hi Phil,

      basically i want to create another column to calculate the differences from first records to the 5/6 records.

      For example assuming its minus from 1st record and the 5th record,
      NAMES AGE DIF
      Alex 56 25
      Aaron 23 16
      Bryron 14 26
      Brian 35 45
      Chole 25 etc
      Colt 16 etc
      Eric 26 etc
      John 45 etc

      I hope this helps. :)

      Comment

      • PhilOfWalton
        Recognized Expert Top Contributor
        • Mar 2016
        • 1430

        #4
        Sorry, not at all.
        You must define which records are needed for your calculation.
        Are you saying that you always use record No 1 (Alex) in your example and then want the differences in age between Alex and everyone else? That's not what your example shows.

        Are you manually inserting a flag against 2 records and asking for the difference in age, if so, by the time you've selected the two records concerned, you could have worked it out in your head.

        So back to the original question. I need a strictly defined rule of which records (people) whose age difference is required.

        Phil

        Comment

        • johnx1980
          New Member
          • Oct 2016
          • 3

          #5
          Hi Phil,

          I apologies for not being clear. I am not sure what you mean by defined rule.

          would it help if i told you that i wanted the value of age at record 1 to minus the value of age record 5, it goes for example,
          1. rec 1 - rec 5
          2. rec 2 - rec 6
          3. rec 3 - rec 7
          4. etc..

          would this help? otherwise, could you give me an example on what you mean by defined rule? i am not a knowledgeable ms access user. just a basic user.

          Comment

          • PhilOfWalton
            Recognized Expert Top Contributor
            • Mar 2016
            • 1430

            #6
            So are you saying the required records are ALWAYS 4 records apart? - That would be an example of a rule.

            However in your JPG example, the selected records are 6 apart, so I don't think we're there yet.

            Obviously, I am not being clear either. Ignoring databases, when comparing two "things" you must have a way of accurately defining which "things" you want to compare.

            Same applies to a database. When you want to compare two records, you must have a method of defining which records.
            For example you could use two Combo Boxes, one to select each person. Very tedious, but it could be done.

            In your JPG example what made you choose Aaron & John? How do you want to indicate to the program that those were the selected records?

            Phil

            Comment

            Working...