+ Reply to Thread
Results 1 to 6 of 6

How to quickly calculate

  1. #1
    Forum Contributor
    Join Date
    12-27-2021
    Location
    China
    MS-Off Ver
    Ms office 2019
    Posts
    282

    Exclamation How to quickly calculate

    May I ask how to quickly calculate the table data on the right based on the sample data on the left.
    Can you provide two solutions: Excel formulas and VBA? If my age group changes, can I quickly modify these two plans?
    My actual data has at least 300 lines, and if given enough time during the work process, I can also write code.
    However, I don't have enough time at work, and I don't know how to quickly calculate the results.
    Moreover, the code I can write is to determine the age range through multiple if conditions.
    I really hope that a skilled expert can give me an answer, thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,859

    Re: How to quickly calculate

    In L3:
    =SUMPRODUCT(($C$2:$C$6=$L$1)*($B$2:$B$6>=-(-LEFT($K3,2)))*($B$2:$B$6<=-(-RIGHT($K3,2))))
    In M3:
    =SUMPRODUCT(($C$2:$C$6=$L$1)*($B$2:$B$6>=-(-LEFT($K3,2)))*($B$2:$B$6<=-(-RIGHT($K3,2))),($D$2:$D$6))
    In N3:
    =SUMPRODUCT(($C$2:$C$6=$N$1)*($B$2:$B$6>=-(-LEFT($K3,2)))*($B$2:$B$6<=-(-RIGHT($K3,2))))
    In O3:
    =SUMPRODUCT(($C$2:$C$6=$N$1)*($B$2:$B$6>=-(-LEFT($K3,2)))*($B$2:$B$6<=-(-RIGHT($K3,2))),($D$2:$D$6))
    Copy down to K6. Adjust the '6' in $B$6, $C$6, & $D$6 to suit whatever your last data row is.

    Simply changing the age ranges in column K or adding new age ranges and copying the formulae down will result in an updated set of calculations.
    Last edited by macropod; 06-05-2025 at 08:28 AM.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Valued Forum Contributor
    Join Date
    03-05-2025
    Location
    Deutschland
    MS-Off Ver
    MS Office Home & Business 2024
    Posts
    425

    Re: How to quickly calculate

    Hi 302,

    like this, see attachment:

    Please Login or Register  to view this content.
    BR, Alexandra
    Attached Files Attached Files
    Best regards, Alexandra

    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved"

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,531

    Re: How to quickly calculate

    Avoid sheet interaction as much as possible.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 06-05-2025 at 08:24 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Contributor
    Join Date
    12-27-2021
    Location
    China
    MS-Off Ver
    Ms office 2019
    Posts
    282

    Re: How to quickly calculate

    Dear macropod,cysu11 and bakerman2. Thank you very much for your help.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,531

    Re: How to quickly calculate

    You're welcome and thanks for rep+.

+ 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] quickly calculate avg/stdev
    By kslst13 in forum Excel General
    Replies: 14
    Last Post: 07-15-2017, 06:44 PM
  2. How to quickly calculate % for this file?
    By duynam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-27-2013, 05:17 AM
  3. HELP!!! need help!and quickly!
    By Brightmaster in forum Excel General
    Replies: 4
    Last Post: 01-03-2007, 12:26 PM
  4. In need of some assistance Quickly!
    By alexm999 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2006, 03:45 PM
  5. HOW to make sub run more quickly
    By EXCEL NEWS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2006, 05:50 PM
  6. need help quickly!!
    By alexm999 in forum Excel General
    Replies: 3
    Last Post: 02-28-2006, 10:42 AM
  7. Need help quickly!!!
    By alexm999 in forum Excel General
    Replies: 0
    Last Post: 04-21-2005, 07:34 AM

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