+ Reply to Thread
Results 1 to 14 of 14

CountIF and CountIFS not returning correct result

  1. #1
    Registered User
    Join Date
    08-01-2019
    Location
    Sydney australia
    MS-Off Ver
    Microsoft 365 MSO (Version 2205 Build 16.0.15225.20028) 32-bit
    Posts
    5

    CountIF and CountIFS not returning correct result

    Hi,

    I have a list of numbers and I only want to count those greater than or equal to 1 and less than or equal to 7

    the result should be 34, but it keeps coming out as 32.

    I've used this:
    =COUNTIF(A1:A70,"<=7"). Answer = 32

    I've also used this:

    =COUNTIFS(A1:A70,">=1",A1:A70,"<=7"). Answer equals 29

    it should be 34 in my example - A1 to A70

    1
    1
    1
    1
    1
    1
    1
    1
    2
    2
    2
    2
    2
    4
    4
    4
    4
    5
    5
    5
    5
    5
    5
    5
    5
    5
    5
    5
    6
    7
    7
    7
    7
    7
    8
    8
    9
    9
    11
    11
    12
    12
    12
    12
    12
    12
    12
    12
    12
    13
    13
    13
    13
    13
    14
    14
    18
    19
    19
    19
    21
    22
    27
    29
    34
    34
    39
    41
    50
    56

  2. #2
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    Welcome to the forum.

    You must have some leading or trailing spaces somehere. Using your numbers:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    B
    C
    D
    32
    7
    33
    7
    34
    7
    34
    =COUNTIF(A1:A70,"<=7")
    35
    8
    34
    =COUNTIFS(A1:A70,">=1",A1:A70,"<=7")
    36
    8
    37
    9
    Sheet: Sheet1

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Are you still using Excel 2010???
    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.

  3. #3
    Registered User
    Join Date
    08-01-2019
    Location
    Sydney australia
    MS-Off Ver
    Microsoft 365 MSO (Version 2205 Build 16.0.15225.20028) 32-bit
    Posts
    5

    Re: CountIF and CountIFS not returning correct result

    thanks for the reply Ali:
    Version - Microsoft? Excel? for Microsoft 365 MSO (Version 2205 Build 16.0.15225.20028) 32-bit

    I've attached a copy of the example
    Attached Files Attached Files

  4. #4
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    Please update your profile, which is stuck on Excel 2010, to MS365.

    I will have a look.

  5. #5
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    Here's why:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    3
    0.572083333
    4
    1.266319444
    5
    1.315370370
    6
    1.329155093
    7
    1.412372685
    8
    1.468113426
    9
    1.530740741
    10
    2.055173611
    11
    2.057546296
    12
    2.078969907
    13
    2.102916667
    14
    4.316122685
    15
    4.335706019
    16
    4.413402778
    17
    4.441527778
    18
    4.514236111
    19
    4.532557870
    20
    4.581712963
    21
    4.631759259
    22
    5.302731481
    23
    5.306030093
    24
    5.307592593
    25
    5.308877315
    26
    5.335277778
    27
    5.400879630
    28
    5.417476852
    29
    6.314745370
    30
    6.570428241
    31
    6.614039352
    32
    6.617083333
    33
    7.252939815
    34
    7.446689815
    35
    7.633171296
    36
    8.386481481
    Sheet: Sheet1

  6. #6
    Registered User
    Join Date
    08-01-2019
    Location
    Sydney australia
    MS-Off Ver
    Microsoft 365 MSO (Version 2205 Build 16.0.15225.20028) 32-bit
    Posts
    5

    Re: CountIF and CountIFS not returning correct result

    do you know how I can fix?

  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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    Try this:

    =SUMPRODUCT((ROUND(A1:A70,0)<=7)*(A1:A70<>""))

    and this:

    =SUMPRODUCT((ROUND(A1:A70,0)<=7)*(ROUND(A1:A70,0)>=1)*(A1:A70<>""))

    Rounding via cell formatting does not change the underlying number.

  8. #8
    Registered User
    Join Date
    08-01-2019
    Location
    Sydney australia
    MS-Off Ver
    Microsoft 365 MSO (Version 2205 Build 16.0.15225.20028) 32-bit
    Posts
    5

    Re: CountIF and CountIFS not returning correct result

    I've attached a piece of the SS where the data is coming from.
    Ultimately I want to collate these days into:

    Cases - 1 week old
    2 weeks old
    3 weeks old
    etc
    Last edited by liz61g; 08-02-2022 at 01:53 AM.

  9. #9
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    Your formulae refer to a workbook on your drive and are returning #REF! errors:

    =TODAY()-'\\ms.zurich.com.au\dfs\GroupsGen\LifeDistribution\OnePath Distribution\Adviser Sales\OneCall Team\OneCall Reporting\OneCall reporting - Zurich\2021 - 2022\All open cases new sharepoint.xlsx'!Table_complaints[@Created]+1

    Please fix this and post again.
    Last edited by AliGW; 08-02-2022 at 01:52 AM.

  10. #10
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    This might be what you want:

    =((TODAY()-INT(A2))/7)+1
    Attached Files Attached Files
    Last edited by AliGW; 08-02-2022 at 01:55 AM. Reason: Added example workbook.

  11. #11
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    If post #10 isn't what you want, then we need a workbook with expected results mocked up manually, please. Let me know.

  12. #12
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    No response ... Looked and then disappeared.

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

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon (* 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 all those who offered help.
    Last edited by AliGW; 08-02-2022 at 02:21 AM.

  13. #13
    Registered User
    Join Date
    08-01-2019
    Location
    Sydney australia
    MS-Off Ver
    Microsoft 365 MSO (Version 2205 Build 16.0.15225.20028) 32-bit
    Posts
    5
    Thanks so much. That was extremely helpful and worked perfectly
    Last edited by AliGW; 08-02-2022 at 03:51 AM. Reason: Please DON'T quote unnecessarily!

  14. #14
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: CountIF and CountIFS not returning correct result

    You're welcome.

+ 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] COUNTIFS function not returning correct results
    By cosmica67 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-27-2021, 02:20 PM
  2. countifs not returning correct value
    By MP1989 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-17-2019, 05:05 PM
  3. [SOLVED] SUM function not returning correct result
    By rayted in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-26-2018, 11:04 AM
  4. [SOLVED] Countifs no returning the correct value
    By lizsantiago07 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2017, 11:08 PM
  5. Formula not returning correct result
    By Patcheen in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-20-2016, 07:05 PM
  6. [SOLVED] LOOKUP not returning correct result
    By TPS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-15-2016, 10:40 PM
  7. >= formula not returning correct result when it is =
    By SMITH.CRYSTAL in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-15-2016, 12:50 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