Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Copy to Summarise data based on 2 criteria: User ID and gaps in continuous day segments for same user

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member ayazgreat's Avatar
    Join Date
    Mar 2012
    Posts
    86
    Rep Power
    13

    Copy to Summarise data based on 2 criteria: User ID and gaps in continuous day segments for same user

    Hi Krish.
    I have posted subjected thread on below link and i request you please help me to resolve it

    https://www.mrexcel.com/board/thread...-date.1223851/


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg
    https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg. 9C-br0lEl8V9xI0_6pCaR9
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg. 9bl7m03Onql9xI-ar3Z0ME
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg. 9gdrYDocLIm9xI-2ZpVF-q
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg. 9id_Q3FO8Lp9xHyeYSuv1I
    https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    ttps://www.youtube.com/watch?v=LP9fz2DCMBE
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg. 9wdo_rWgxSH9wdpcYqrvp8
    ttps://www.youtube.com/watch?v=bFxnXH4-L1A
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg
    ttps://www.youtube.com/watch?v=GqzeFYWjTxI
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 11-30-2023 at 03:02 PM. Reason: More descriptive Title based on final solutions
    Somthing is better than nothing

  2. #2
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    my three cents with Power Query

    Numbers ID StartDate EndDate
    12345
    22
    03/01/2022
    06/01/2022
    23456
    22
    03/01/2022
    04/01/2022


    Code:
    // Table1
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Type = Table.TransformColumnTypes(Source,{{"Numbers", Int64.Type}, {"ID", type text}, {"Date", type date}}),
        Group = Table.Group(Type, {"Numbers", "ID"}, {{"StartDate", each List.Min([Date]), type date}, {"EndDate", each List.Max([Date]), type date}})
    in
        Group
    Last edited by sandy666; 05-14-2024 at 02:03 AM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  3. #3
    Member ayazgreat's Avatar
    Join Date
    Mar 2012
    Posts
    86
    Rep Power
    13
    Quote Originally Posted by sandy666 View Post
    my three cents with Power Query

    Numbers ID StartDate EndDate
    12345
    22
    03/01/2022
    06/01/2022
    23456
    22
    03/01/2022
    04/01/2022


    Code:
    // Table1
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Type = Table.TransformColumnTypes(Source,{{"Numbers", Int64.Type}, {"ID", type text}, {"Date", type date}}),
        Group = Table.Group(Type, {"Numbers", "ID"}, {{"StartDate", each List.Min([Date]), type date}, {"EndDate", each List.Max([Date]), type date}})
    in
        Group
    Thanks for your reply I just want to know that where should I copy these power query code to run further I have 5 lacs rows of data so how much does it take time to complete ?
    Last edited by ayazgreat; 12-06-2022 at 02:02 AM.
    Somthing is better than nothing

  4. #4
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    1. don't quote whole post, this is not necessary
    2. update your profile about excel version
    3. your source data should be an Excel Table
    4. whole work took me approx. 10 seconds to take the result table (including drinking coffee)
    5. FYI: this is NOT vba
    Attached Files Attached Files
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  5. #5
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  6. #6
    Member ayazgreat's Avatar
    Join Date
    Mar 2012
    Posts
    86
    Rep Power
    13
    I am facing an issue of incorrect result and furthermore if add following column in result sheet so how should power query be updated
    Attached Files Attached Files
    Somthing is better than nothing

  7. #7
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    as you can see there is no date 02/04/2022 in the source data (copied from mrexcel)
    attach proper example with detailed description what you want to achieve and we will see what will be
    Last edited by sandy666; 12-06-2022 at 07:34 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  8. #8
    Member ayazgreat's Avatar
    Join Date
    Mar 2012
    Posts
    86
    Rep Power
    13
    My Actual required result in attached file in result sheet if anybody can solve it please through VBA code ?
    Attached Files Attached Files
    Somthing is better than nothing

  9. #9
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Hello
    I have the same problem that everyone else is having with you.
    You are not explaining clearly enough for anyone to understand what you want, and you keep changing your data and results.

    So it is impossible for anyone to help you.




    For example, in your latest file this is the data

    Row\Col A B C D
    1 Numbers ID Date
    2 12345 22 01/03/2022
    3 12345 22 01/03/2022
    4 12345 22 01/03/2022
    5 12345 22 01/03/2022
    6 12345 22 01/05/2022
    7 12345 22 01/05/2022
    8 12345 22 01/06/2022
    9 12345 22 01/06/2022
    10 12345 22 04/02/2022
    11 12345 22 04/02/2022
    12 12345 22 04/02/2022
    13 12345 22 04/03/2022
    14 12345 22 04/03/2022
    15 12345 22 04/04/2022
    16 23456 22 01/03/2022
    17 23456 22 01/03/2022
    18 23456 22 01/03/2022
    19 23456 22 01/04/2022
    20 23456 22 01/04/2022
    21
    Worksheet: Data


    , and this is your results.

    Row\Col A B C D E F G
    1 Number ID Start Date End Date Days Working Days
    2 12345 22 01/03/2022 04/04/2022 92 64 Incorrect
    3 23456 22 01/03/2022 01/04/2022 2 1
    4
    5
    6
    7 12345 22 01/03/2022 01/06/2022 4 3 Correct
    8 12345 22 04/02/2022 04/04/2022 3 0
    Worksheet: Result

    It is impossible to understand why you have more than one result for 12345


    Alan
    Last edited by DocAElstein; 12-09-2022 at 02:52 AM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  10. #10
    Member ayazgreat's Avatar
    Join Date
    Mar 2012
    Posts
    86
    Rep Power
    13
    Alan,

    Please find attached updated file for your question that why I have more than 1 result for 12345.
    Actually if you see result sheet I am calculating total days and total working days between start date and end date and all result is based on each number and different dates of each number.
    Attached Files Attached Files
    Last edited by ayazgreat; 12-09-2022 at 08:21 AM.
    Somthing is better than nothing

Similar Threads

  1. Select column based on user input
    By Wall31 in forum Excel Help
    Replies: 4
    Last Post: 06-21-2020, 06:18 AM
  2. Replies: 5
    Last Post: 06-13-2014, 08:37 PM
  3. Copy paste data based on criteria
    By analyst in forum Excel Help
    Replies: 7
    Last Post: 01-13-2014, 12:46 PM
  4. Replies: 2
    Last Post: 09-18-2013, 12:30 AM
  5. Insert Or Delete Columns Based On User Input
    By HDMI in forum Excel Help
    Replies: 4
    Last Post: 06-21-2013, 03:00 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
  •