+ Reply to Thread
Results 1 to 8 of 8

Need help with syntax. Countif Function Not Counting Correctly.

  1. #1
    Registered User
    Join Date
    12-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Need help with syntax. Countif Function Not Counting Correctly.

    I need your help. I would appreciate any consideration.

    Objective:

    Note: SLD = sold, PEN = pending, both are values in the stat_b(status) column of my spreadsheet.

    I'm trying to get a count on the sold items(val) that meet the date requirement(sold items in the last 6 months). You'll find the functions that I attempted to use below, labeled as v1 through v4.

    The problem my be user error or it may be the platform that I am using (Gnumeric Spreadsheet 1.10.17; updated from Gnumeric Spreadsheet 1.4.3). Both version resulted in the same problem. Please help!!! Oh by-the-way, using Gnumeric is not by choice. My Macbook computer got stolen from me and now all I'm left with is an old Inspiron 2200. I made the mistake by becoming complacent and didn't backup anything on my macbook because it ran so well. I never gave it being stolen a thought. Oh, well. Any how if I had it my way I'd be using Excel. Thanks for listening.

    v1: =if(stat_b="SLD"),(countif(c_date,">"&today()-180)),"false")
    Result(R) = true /w miscount cnts all stat_b values that meets the countif condition. The result should be limited to the "SLD" val + countif cond only. cnt = 3; the correct count should be 1. There is only one "SLD" val that meets the date condition.

    v2: =if(stat_b="PEN"),(countif(c_date,">"&today()-180)),"false") R = false (Should read true; PEN meets req.)

    v3: =if(countif(stat_b,"="&"SLD"),(countif(c_date,">"&today()-180)),"false")
    R = true /w miscount cnt = 3 (see ver1)

    v4: =COUNT(IF((stat_b="SLD")*(c_date>=today()-180),"false"))
    R = true /w miscount cnt = 0

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Need help with syntax. Countif Function Not Counting Correctly.

    This seems to work in Excel 2007:

    =COUNTIFS(stat_B,"SLD",c_date,">"&TODAY()-180)

    Not sure if it would work in Gnumeric though.

    You cold also try SUMPRODUCT:

    =SUMPRODUCT((stat_B="SLD")*(c_date>TODAY()-180))

    - Moo

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Need help with syntax. Countif Function Not Counting Correctly.

    one would have thought questions on gnumeric belong in a gnumeric forum no?
    http://www.excelforum.com/for-other-...mobile-os-etc/
    Last edited by martindwilson; 12-15-2012 at 10:22 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    12-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need help with syntax. Countif Function Not Counting Correctly.

    Thank you very much. I have not tried your suggestion yet but I will soon. And I'll let you know how it went. Thanks again.

  5. #5
    Registered User
    Join Date
    12-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need help with syntax. Countif Function Not Counting Correctly.

    Perhaps you're right if syntax is the issue; I wasn't sure. Nevertheless, I thought I would receive better help from Excel users (maybe just a perception on my part). I prefer to use and be in the Excel camp but my situation doesn't permit the luxury at this time. If Moo the Dog's suggestions doesn't help then maybe I'll try looking for the help elsewhere.

  6. #6
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Need help with syntax. Countif Function Not Counting Correctly.

    Perhaps a Pivot Table is an option here. Have you tried using one? You can apply many filters on the Pivot Table to get just the results you need. It's very efficient.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  7. #7
    Registered User
    Join Date
    12-15-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need help with syntax. Countif Function Not Counting Correctly.

    Dear Moo the Dog, I want to say thank you very much. The sumproduct formula you suggested worked perfectly in spite of Gnumeric. I expanded it to meet my other needs. Here’s the final result that I used based on the information you gave me:

    =sumproduct((stat_b="SLD")*(sp_b>=90000)*(sp_b<=99999)*(c_date>=today()-180))

    Maybe your information here can help other folks with similar needs.

    Thank you so much Moo!!

    P.S. I wish you and your family a great Christmas & happy holidays.

    Moderator's Note: As per Forum Rule #12, please don't quote whole posts unless necessary...it's just clutter...Thanks.
    Last edited by jeffreybrown; 12-16-2012 at 03:00 PM.

  8. #8
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Need help with syntax. Countif Function Not Counting Correctly.

    mmtalon,

    Thanks for the holiday wishes. Same to you and yours. I'm glad to help.

    Feel free to leave feedback for me, and any others who may have helped, by clicking on the small star to the lower-left corner of one of my posts. It's always appreciated.

    - Moo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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