Results 1 to 15 of 15
  1. #1
    Terri H is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    6

    Calculating weight & showing this in stones & pounds

    Hi, I need to calculate CUMULATIVE weight loss over a number of weeks, and show the result in stones and pounds (that is "st" and "lbs" added as text).



    Here's a scenario:
    In Week 1, the starting weight is 13 st 6 lbs
    In Week 2, the new weight is 13 st 2 lbs, so the loss = 4 lbs
    In Week 3, the new weight is 12st 12 lbs, so the cumulative loss, from Week 1 to Week 3 = 8 lbs
    In Week 4, the new weight is 12st 5 lbs, so the cumulative loss, from Week 1 to Week 4 = 15 lbs... or 1st 1 lb

    Whilst I can manage the basic maths bit, I just can't seem to find a way to include concatenation as well, so that the cumulative total for Week 4 shows as a loss of "1 st 1 lb".

    I am more proficient in Excel and, there, I am using this formula: =CONCATENATE(ROUNDDOWN(A1/14,0)," st ",MOD(A1,14)," lbs") where A1 is the weekly weight loss in pounds.

    Can anyone help?
    Many thanks
    Terri

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Can you tell us about what tables and the fields they have. Perhaps even post a copy of the db.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Terri H is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    6
    Thank you, Bob. I've only just started writing the database, so it's a bit of a testbed mess at the moment. I can take an extract as an example, then post that here, if that would help.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Quote Originally Posted by Terri H View Post
    Thank you, Bob. I've only just started writing the database, so it's a bit of a testbed mess at the moment. I can take an extract as an example, then post that here, if that would help.
    Come Terri. Don't be shy. Show us what you've got.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Terri H is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    6
    Thank you, Bob. I've only just started writing the database, so it's a bit of a testbed mess at the moment. I can take an extract as an example, then post that here, if that would help.

  6. #6
    Terri H is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    6
    I'm trying to upload a test db, but I'm getting a message that it's too large to post? Max file size 500 kb? It's less than 800 kb. How to I attach it?

  7. #7
    Terri H is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    6

    Sample database

    Thanks Bob, I've zipped it. TH_WeightTrackerTest1.zip

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Quote Originally Posted by Terri H View Post
    I'm trying to upload a test db, but I'm getting a message that it's too large to post? Max file size 500 kb? It's less than 800 kb. How to I attach it?
    Do a "Compact and Repair" then Zip the db and attach the zipped file.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Quote Originally Posted by Terri H View Post
    Thanks Bob, I've zipped it. TH_WeightTrackerTest1.zip
    Terri
    I've had the briefest of looks at your db. Access is not "another kind" of spreadsheet or vice versa.
    Before you go any further with your project I would recommend that you normalise your tables and read a little on database design.
    I'm sure that there will be countless posts here on the subject but please feel free to post back if you need further help.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Too new for me to look at form wise, but I would have thought you would need to convert to lbs and recalc.
    Simple enough as

    intStone & " Stone " & intLbs & "lbs"
    You are doing no more than you did in Excel
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Quote Originally Posted by Bob Fitz View Post
    Terri
    I've had the briefest of looks at your db. Access is not "another kind" of spreadsheet or vice versa.
    Before you go any further with your project I would recommend that you normalise your tables and read a little on database design.
    I'm sure that there will be countless posts here on the subject but please feel free to post back if you need further help.
    Sounds like you may as well just leave it in Excel?, better graphing etc? and you are familiar with it?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    agree with others, your table design is not appropriate for a database

    would expect something like

    tblWeighings
    PK....wDate....Weight

    where weight is in lbs.

    the equivalent of your excel calculation

    would be

    15\14 & " St " & 15 mod 14 & " lbs"

    which will return '1 St 1 lbs'


    rather than trying to add all the individual losses, just deduct the first week from the current week

  13. #13
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @Terri
    I agree with the others about the db design, so I started making some changes and all of a sudden several hours went by.

    I don't know if you want more than 4 weeks and I don't know if the dB is for many more people, so I added a person table, changed the Weight Table to be able to add a million more weight readings and changed the form to be a main form/sub form arraignment. I had to write a couple of UDFs to do the calcs (and the numbers even match yours!).

    On the form if you see controls with a yellow backcolor (in design view).... that is my way of having PK/FK controls/fields on the form.

    Maybe this will help you a little....


    And Welcome to the forum....
    Attached Files Attached Files

  14. #14
    Terri H is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2022
    Posts
    6
    Thank you, Steve. This has certainly helped to unmuddle my thinking! I'm new to Access, just self-learning really, and enjoying exploring a new approach. Your suggestions are very helpful and they've enabled me to step away from the more linear process I've been used to with Excel. Thanks for taking the time and trouble.

  15. #15
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Happy to help.

    I know it is hard to get out of an Excel brain and into a RDBMS brain.

    15 - 20 years ago I was using/coding Excel and a little scripting in FileMaker Pro (mac ); now I've been using Access for so long that I struggle when I have to code in Excel.



    Good luck with your project....

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

Similar Threads

  1. Replies: 4
    Last Post: 07-18-2019, 10:10 AM
  2. Help creating weight calculator
    By mindbender in forum Forms
    Replies: 11
    Last Post: 09-21-2018, 10:34 AM
  3. Calculating Average Weight - Broken SUM
    By redekopp in forum Access
    Replies: 13
    Last Post: 04-12-2017, 09:04 AM
  4. Convert between kilograms & pounds
    By wrangler_0002004 in forum Access
    Replies: 6
    Last Post: 07-25-2012, 03:32 AM
  5. Replies: 3
    Last Post: 02-24-2012, 01:23 PM

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