+ Reply to Thread
Results 1 to 20 of 20

Count fields based on Month

  1. #1
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Count fields based on Month

    The Detail tab has the data that I'm trying to pull the information from and placing the information in separate tabs based on the month (ie. Jan, Feb, Mar ...). I've figured out the formula on how to pull the data for the matching criteria, but I need to sperate by month.

    Thanks in advance!!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: Count fields based on Month

    For B2, how about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Count fields based on Month

    Shifty58 would you be OK with some added helper columns in the Detail sheet?
    Dave

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Count fields based on Month

    Rather than helper columns in the data source try as in the attached. With sheets Jan and Feb grouped insert a row in row 1.

    Then with those sheets still grouped this formula in cell A1 of Jan sheet will copy down through all the grouped sheets a giving a 1st of the month reference relative to each sheet in question.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Format as desired.

    Then with sheets still grouped this in B3 copied down and across to D8 should also get you started.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    The SUMIFS works great in columns B, C and D! Can you look at columns E and F?

  6. #6
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    Also column G. Sorry

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Count fields based on Month

    The syntax for AVERAGEIFS is pretty much the same as for SUMIFS. Ditto COUNTIFS. I thought that would give you a good start figuring out the rest.

    This isn't a homework assignment is it?

    So in E3 and filled down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in F3
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    G3
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 12-06-2022 at 05:45 PM. Reason: Afterthoughts

  8. #8
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    All 3 formulas returned the value of 0.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: Count fields based on Month

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    G3 is returning a value of 0 (zero).

    E3 and F3 are working properly.

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: Count fields based on Month

    What formula do you have in G3?

  12. #12
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    =COUNTIFS(Detail!$M$2:$M$506,TEXTAFTER($A3,"-"),Detail!$A$2:$A$506,">"&EOMONTH($A$1,-1),Detail!$A$2:$A$506,"<="&EOMONTH($A$1,0))

  13. #13
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: Count fields based on Month

    What is in A1?

  14. #14
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    My apologies, that formula was suggested by FlameRetired. A1 is the word "Date". Maybe you might want to look at column G in the original spreadsheet.

  15. #15
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,708

    Re: Count fields based on Month

    For that formula A1 needs to be a date, not the word Date.

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Count fields based on Month

    Quote Originally Posted by Shifty58 View Post
    All 3 formulas returned the value of 0.
    They all work at my end. Please see the attached.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    Row A contains my column headings, which I need to keep. What do I need to change in the formula for it to work?

    Also I don't believe TEXTAFTER($A3,"-") is correct since my dates are formatted in the following way. 1/25/2022 not 1-25-2022.

  18. #18
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Count fields based on Month

    That part of the formula is not referencing a date. It contains Total Knee - 1 which appears to refer to procedure "1" which is a knee procedure. The rest in column A (sheets Jan:Feb) are:

    Total Hip - 2
    Total Shoulder - 3
    Spine - 4
    Bilat. Total Knee - 5
    Bilat. Total Hip - 6


  19. #19
    Registered User
    Join Date
    02-09-2021
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Count fields based on Month

    In my original formula I identified the numbers 1-6 (see below). All I need is for the formula to pull the data by number (1-6) and the month.

    G2 =COUNTIF(Detail!$M$2:$M$506,1)
    G3 =COUNTIF(Detail!$M$2:$M$506,2)
    G4 =COUNTIF(Detail!$M$2:$M$506,3)
    G5 =COUNTIF(Detail!$M$2:$M$506,4)
    G6 =COUNTIF(Detail!$M$2:$M$506,5)
    G7 =COUNTIF(Detail!$M$2:$M$506,6)

  20. #20
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,817

    Re: Count fields based on Month

    Looking at the file attached to post #1, try the following in G2 on the Jan sheet:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For the Feb sheet:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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] Extract fields based on current Date and Month
    By Neilesh Kumar in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 08-18-2021, 04:30 AM
  2. Replies: 1
    Last Post: 04-25-2021, 05:50 AM
  3. formula needed - 2 dates fields and summarizing to count/month
    By vkeefe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-21-2019, 10:05 AM
  4. Calculated fields based on the count of a field
    By FernTurpin in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-08-2019, 10:07 AM
  5. Change Pivot Table Fields Month by Month Automatically
    By phoebeyanan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2017, 04:03 PM
  6. How to Disable automatic fields in pivot table like total and count on fields
    By anushka in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-24-2009, 07:53 AM
  7. Count the occurances of a month in a range of date fields
    By Keith Brown in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-14-2005, 08:06 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