+ Reply to Thread
Results 1 to 15 of 15

To display same total value if registration number and month matches

Hybrid View

  1. #1
    Registered User
    Join Date
    04-27-2024
    Location
    Singapore
    MS-Off Ver
    365
    Posts
    12

    To display same total value if registration number and month matches

    Hi,

    Would greatly appreciate that expert can help me with this formula.

    I have a column for public holiday and weekend and would like to sum it up and display it in another column with the same value for the entire month for that particular registration number.

    This is the data

    1.png

    This is the intended result

    2.png

    Thank you for all the assistance

    Shihtzu

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,983

    Re: To display same total value if registration number and month matches

    Hi and welcome to the forum

    Pictures are of little value. Honestly, no one wants to re-type your data to try and solve your issue. Additionally, we would only be guessing at how your data was structured, ie. formulas, formatting, etc. Additionally, due to how some browsers behave, many of our members cannot see uploaded pictures/images. Please do not take this route.

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" of what you wish the output to be.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    04-27-2024
    Location
    Singapore
    MS-Off Ver
    365
    Posts
    12

    Re: To display same total value if registration number and month matches

    Hi alansidman,

    Thank you for your reply and reminder. I have forgotten to attach the file earlier.

    Shihtzu
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,493

    Re: To display same total value if registration number and month matches

    Sub dd()
    Dim a, z As New Collection, v,v1
    a = Sheets("DATA").Range("A1").CurrentRegion.Value
    For i = 2 To UBound(a, 1)
       On Error Resume Next
         z.Add Key:=CStr(a(i, 1)), Item:=New Collection
         With z(CStr(a(i, 1)))
            .Add Key:=CStr(Month(CDate(a(i, 2)))), Item:=Array(New Collection,CreateObject("System.Collections.Arraylist"),Month(Cdate(a(i,2))))
            If Weekday(CDate(a(i, 2))) = 1 Then
             .Item(CStr(Month(CDate(a(i, 2)))))(0).Add a(i, 2)
            ElseIf a(i,4) > 0 then
              .Item(CStr(Month(CDate(a(i, 2)))))(1).Add a(i, 4)
            End If
         End With
       On Error GoTo 0
    Next i
    Dim tt as long
    With Sheets.Add
    For i = 2 To UBound(a, 1)
        Set v = z(CStr(a(i, 1)))(CStr(Month(CDate(a(i, 2)))))(0)
        v1 = Application.Sum(z(CStr(a(i, 1)))(CStr(Month(CDate(a(i, 2)))))(1).Toarray())
         a(i, 5) = v.Count + v1
         a(i,6) = a(i,5) + v1
    Next i
     .Cells(1, 1).Resize(UBound(a), )).Value = a
    End With
    End Sub
    Last edited by daboho; 05-05-2024 at 10:18 AM.
    "Presh Star Who has help you *For Add Reputation!! And mark case as Solve"

  5. #5
    Registered User
    Join Date
    04-27-2024
    Location
    Singapore
    MS-Off Ver
    365
    Posts
    12

    Re: To display same total value if registration number and month matches

    Hi daboho,

    Thank you very much for your help but is there anyway we can work with formulas? I am not sure where to insert the codes.

    Shihtzu

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,140

    Re: To display same total value if registration number and month matches

    But you posted in the VBA section ...
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,140

    Re: To display same total value if registration number and month matches

    In F2:

    =E2:E61+1


  8. #8
    Registered User
    Join Date
    04-27-2024
    Location
    Singapore
    MS-Off Ver
    365
    Posts
    12

    Re: To display same total value if registration number and month matches

    Hi AliGW,

    My apology for posting at the wrong thread.

    Your recommended formula works only if PH has a value of 1 but will not work if the value other than 1. F column will automatically add 1 no matter whether there is value in column D even it is 0.

    Shihtzu

  9. #9
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,493

    Re: To display same total value if registration number and month matches

    What is you want to sum, you wan sum column E (weekend), or column F (Rest Work), i want clearly if same as REG (A) and month (B) and what with PH can you explain with clearly

  10. #10
    Registered User
    Join Date
    04-27-2024
    Location
    Singapore
    MS-Off Ver
    365
    Posts
    12

    Re: To display same total value if registration number and month matches

    Hi daboho,

    I want to sum column D (PH) and E(WEEKEND). The result in F(REST_WORK) will display the same value for the entire month with the same registration number.

    3.png

    Shihtzu

  11. #11
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,493

    Re: To display same total value if registration number and month matches

    Perhab like this
    =SUM(D3:INDEX($D$2:$D$61,AGGREGATE(14,6,ROW($A$2:$A$61)-1/(($A$2:$A$61=A3)*($C$2:$C$61=C3)),1)))+E3
    Or.like this
    =SUM(INDIRECT("D" &AGGREGATE(15,6,ROW($A$2:$A$61)/(($A$2:$A$61=A2)*($C$2:$C$61=C2)),1) &":D" &AGGREGATE(14,6,ROW($A$2:$A$61)/(($A$2:$A$61=A2)*($C$2:$C$61=C2)),1)))+E2
    Last edited by daboho; 05-05-2024 at 11:04 AM.

  12. #12
    Registered User
    Join Date
    04-27-2024
    Location
    Singapore
    MS-Off Ver
    365
    Posts
    12

    Re: To display same total value if registration number and month matches

    HI daboho ,

    Thank you very much. The 2nd formula works.


    Shihtzu

  13. #13
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,493

    Re: To display same total value if registration number and month matches

    Ok mark case as solved!!

  14. #14
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,983

    Re: To display same total value if registration number and month matches

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon (Next to Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  15. #15
    Registered User
    Join Date
    04-27-2024
    Location
    Singapore
    MS-Off Ver
    365
    Posts
    12

    Re: To display same total value if registration number and month matches

    Thank you Alan

    Learn new things everyday

+ 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] display total sales at the end of each month from date-wise data
    By Ranjeet2001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-11-2014, 01:20 AM
  2. [SOLVED] Calculating Win/Loss, knowing total points, number of matches, and point values.
    By Marthinusjt in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-22-2013, 12:37 AM
  3. Replies: 0
    Last Post: 04-09-2013, 09:36 AM
  4. Summing total registration up to a date
    By ct711 in forum Excel General
    Replies: 2
    Last Post: 12-04-2010, 01:50 AM
  5. Total number of unique matches in two columns
    By JBeaucaire in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-11-2008, 04:27 PM
  6. Finding the total number of matches within two columns?
    By mikexcel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-27-2007, 02:47 PM
  7. [SOLVED] how do i display the total number of days in the current month in.
    By timerigger in forum Excel General
    Replies: 6
    Last Post: 03-20-2005, 02:06 PM

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