+ Reply to Thread
Results 1 to 31 of 31

add ranges depending on several criteria

  1. #1
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    add ranges depending on several criteria

    help with macro, I need the macro to add a range depending on several criteria

    Attached file for better understanding
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: add ranges depending on several criteria

    Can you give more details:
    What is the range and where
    What are the criterias
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    For example 1 of attachment
    the ranges are the columns identified as ID and the values ​​to add are from columns Q to V and the criteria are columns N and P

  4. #4
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    attached image

    Screenshot_65.png

    thanks for answering

  5. #5
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    and for example 2 of the attached file, add column D to the same records in column A, B and C, the result in column E and F

    Screenshot_66.png

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: add ranges depending on several criteria

    Could we say it is for sheet "EJEMPLO1" ??
    Can you give an example with numerical data: Which values is used to give which result ???
    Last edited by PCI; 08-21-2018 at 08:06 AM.

  7. #7
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    Good day, thanks for answering.

    What I want is the following:

    if in column A there are two or more equal records and in column B and C their criteria are equal, total the value of column D

    Origin sheet
    A B C D
    1 123 51 10 600
    2 123 51 10 400
    3 888 52 20 300

    Destiny sheet
    A B C D
    1 123 51 10 1000
    2 888 52 20 300
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    I hope that with this example, greater understanding

  9. #9
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    I'm sorry attach the file that was not.

    As you will see, the result only takes into account column A and not B and C
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: add ranges depending on several criteria

    Let's come back to your last example and last file.
    For ID EP = 123 EP = 1300
    Why, when in sheet "ORIGEN" for ID EP = 123 criteria are not the same
    if in column A there are two or more equal records and in column B and C their criteria are equal, total the value of column D
    Should give 600 + 400 as result for ID EP = 123
    And should exist as result
    123 52 20 300
    Please explain !!!
    Last edited by PCI; 08-21-2018 at 05:07 PM.

  11. #11
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    is correct for the last example the macro works partially, since it totals based on the ID EP and is not taking into account By D

    Screenshot_29.png

    That would be the desired result. For which I ask for your help

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: add ranges depending on several criteria

    OKAY try next code
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    works perfect, is what I needed

    Could I ask you for another favor, to add another parameter?

  14. #14
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    With the previous example, do the same considering the date. That is to say that totals taking into account period (date).

  15. #15
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    Screenshot_32.png

    de esta manera

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: add ranges depending on several criteria

    Do you mean?
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    the code does not work

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: add ranges depending on several criteria

    Quote Originally Posted by fjaimes04 View Post
    the code does not work
    This kind of message will never help.

    How is it not working?

  19. #19
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    when using the code, the results are located and operate differently, as the image shows

    Screenshot_70.png

    I attach the file with the supplied code
    Attached Files Attached Files

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: add ranges depending on several criteria

    My code was for your workbook uploaded one before with the date in col.A.

    For the one you just uploaded.
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    ok, sorry

    I already try it with that example, thank you very much

  22. #22
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    Screenshot_72.png

    is adding the column of E and does not show result in column F where the totals should go.


    but before continuing, I see that the order of the date and registration column is wrong

    Column A = Reg and B = date

    Screenshot_73.png

  23. #23
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: add ranges depending on several criteria

    It is working for me

  24. #24
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    If I see that it works, maybe something went wrong.

    Regarding the last request to change the order, could you help me please?

    Column A = Reg and B = date

  25. #25
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: add ranges depending on several criteria

    Try change to
    Please Login or Register  to view this content.

  26. #26
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    Thank you very much for your help, your collaboration has been very valuable.

  27. #27
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: add ranges depending on several criteria

    do the same considering the date. That is to say that totals taking into account period (date).

    Please give more details:
    Do we need to care about the date as just data to report or use the date as criteria

    For example
    in case
    DATE ID EP GRUPO CENTRO COSTO EP
    30/07/2018 123 51 10 600
    30/08/2018 123 51 10 400
    What will be the result shown ???

  28. #28
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    good day, thanks for answering

    the result was like the one in the picture

    Screenshot_74.png


    REG FECHA ID EP GRUPO CENTRO COSTO EP
    1 30/07/2018 123 51 10 600
    2 30/08/2018 123 51 10 400

  29. #29
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: add ranges depending on several criteria

    See next code
    Please Login or Register  to view this content.

  30. #30
    Registered User
    Join Date
    08-07-2018
    Location
    Cucuta, Colombia
    MS-Off Ver
    2019 y Office 365
    Posts
    25

    Re: add ranges depending on several criteria

    The code works but does not separate the total x month

    Screenshot_35.png

    Regarding the last request to change the order, could you help me please?

    Column A = Reg and B = date

  31. #31
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: add ranges depending on several criteria

    See here
    Please Login or Register  to view this content.

+ 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. add ranges depending on several criteria
    By fjaimes04 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2018, 01:19 PM
  2. add ranges depending on several criteria
    By fjaimes04 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2018, 11:33 AM
  3. Replies: 11
    Last Post: 06-30-2016, 07:07 PM
  4. Replies: 11
    Last Post: 02-12-2015, 10:44 AM
  5. VBA pop-up box depending on time of day - ranges to be defined
    By dancing-shadow in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2014, 11:18 AM
  6. Adding up ranges depending on condition
    By sp_key in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-12-2013, 01:14 PM
  7. Calculate depending on date ranges
    By vicstone in forum Excel General
    Replies: 2
    Last Post: 07-27-2010, 11:42 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