=COUNTIFS(A1:A9,"1",(A1:A9[-1],"0")) ???

I'm in search of a formula for Numbers/Excel that will count the number of cells in a column containing the number 1 only if the previous cell in the column has a 0 in it. I originally thought that =COUNTIFS(A1:A9,"1",(A1:A9[-1],"0")) would work, however it returns with the error "A1:A9 isn't a valid reference." In the example below, the desired answer would be 2, as I only want the count the number of times that a "group" of 1's appears. I'm not sure whether this is even possible, if I have an error in the formula, or even if I have the wrong formula all together.
Any help would be greatly appreciated!
Thanks in advance,
Mikayla
0
0
1
1
1
0
1
1
0
0

Barry:
I appreciate your lengthy answer, but the text string "June 1st" is indeed meant to be text, not in date format, so I was only using "June 1st" as an example. The actual string that is in my data is "italy_final", which only appears once in column D on every sheet, but the row that it appears in varies.
Wayne:
I didn't mean to state how I would like the problem solved. I just thought that there would be some way to expand on the formula that Jeff suggested. Unfortunately, I cannot post the real data, as it is experimental data and its contents are sensitive. In addition, the spreadsheet is very large, 3572 rows and 17 columns to be exact.
Hiroto:
Your suggestion appears to be working well so far, however, I seem to have run into a roadblock. The words MarketW appears as groups in column J five times, but with a similar formula to the one you suggested, I can only seem to get it to return a count of 4 groups.
I have re-created a table with the ACTUAL data (while excluding some data that is not important):
A
B
C
D
E
F
G
H
I
J
K...
1
Practice
Market West Entrance
Market North Entrance
2
1.10
X
Y
Z
0
0
0
357
italy_final
358
15.6
X
Y
Z
0
0
0
MarketN
359
15.7
X
Y
Z
0
0
0
MarketN
360
15.8
X
Y
Z
0
0
0
MarketN
361
15.9
X
Y
Z
0
0
0
MarketW
362
16.0
X
Y
Z
0
0
0
MarketW
363
16.1
X
Y
Z
0
0
0
MarketW
364
16.2
X
Y
Z
0
0
0
MarketW
3571
419.2
X
Y
Z
0
0
0
3572
419.3
X
Y
Z
0
0
0
3573
# of (groups) of visits -->
=COUNTIFS(J$359:J$3572,"MarketW",J$358:J$3571,"-")
=COUNTIFS(OFFSET(J$1,D3573+1,0,3215-D3573),"MarketW",OFFSET(J$1,D3573,0,3215-D35 73),"-")
Please note the jump in rows (2-357), as I have skipped quite a few rows to shorten the data. Column A is time in milliseconds, and X,Y,Z are coordinates. "italy_final" appears only once in column D but varies in row location on each sheet. "MarketW" in column J appears in groups, sometimes filling more than 30 rows at a time, hence the reason I only wanted to count each group once and not each time "MarketW" appears. To count this, I used the formula that Jeff suggested, =COUNTIFS(J$359:J$3572,"MarketW",J$358:J$3571,"-"), and it worked great. Now, I need to keep the practice data up until "italy_final" on the sheet, but ignore this data in columns J and K before italy_final appears.
In short, I need a formula that will count the number of times "MarketW" and "MarketN" appears as a group in columns J and K beginning at the row that italy_final is located in. This is tough though, as I would like to be able to copy and paste the formula to my other sheets, but italy_final appears in a different row on each sheet.
Likely too complicated, but I would ultimately also like to add up the duration of time in column A that MarketW appears. In the example above, I would need to add the difference in time between row 364 and row 361, along with the other occurences of MarketW in column J.
I hope that makes sense and I appologize for (likely) making it more confusing than it needs to be.

Similar Messages

  • Using COUNTIF on time values in pop-up menu (employee schedule template)

    I have modified the Numbers employee schedule template to my liking and it works very well. I would like to add a column to the beginning which shows, at a glance, how many people I have scheduled for AM shifts and PM shifts on a given day. My AM shifts start at 9:00 AM and my PM shifts end at 6:30 or 8:30 PM.
    So I thought I could use COUNTIF, but after I set the array, I cannot get the condition right to return anything except "0". How do you make it detect the appropriate times? The times in each cell for In and Out times are selected using a pop-up menu, just like the template.
    Here is what I tried: =COUNTIF(E3:AE3,"9:00 AM")
    What should the condition be to return a proper count?

    ac,
    You shouldn't feel badly about having trouble with this template. It is a rather tricky one. The values in the Pop-Up menus are Date/Time values. That is to say, they have year, month, day, hour and minute components, even if only the hours and minutes are displayed. So if you only compare to the hours and minutes, you will never get a match.
    I don't know if you have experienced this yet, but when you changed the Pop-Up menu content, you probably entered the current year, month and day unknowingly and will have trouble doing math against the Pop-Up content that was originally in the template.
    My suggestion in your case would be to convert the time references to decimal hours before doing a comparison. For instance, if the time you wish to compare to is in cell C4, you could extract the decimal hours with =HOUR(C4)+MINUTE(C4)/60
    Remember that the hours will reflect a 24-hour day, so times in the afternoon will run from 12.0 to 23.99...
    Then after converting to decimal, instead of using "9:00 AM" for the COUNTIF criteria, use 9.
    There are probably ways to do this using the Duration format as well, but I prefer the decimal hours.
    Hope this helps.
    Jerry

  • Using COUNTIF formula using controlled data in cell pop-up menu

    I'm making a spread sheet that involves adding up the number of times a certain item occurs in a log. A pop-up menu is used in the cell to control the inputs of the log. I'm not sure how to go about using the COUNTIF function to count the number of times each item occurs. The "workout tracker" template in Numbers '09 does what I need to do when counting the "number of days exercised", but I don't understand how it was done. Can anyone explain this to me?
    My log table is: (Dashes denote spacing)
    Date---------Log Item-----Time
    01/03/09---Item 1-------9:00am
    02/03/09---Item 2-------12:15pm
    03/03/09---Item 3-------9:10am
    (you can only chose Item 1, 2 or 3 from a drop down list, you can't manually input anything else)
    I want to use a countif command for a table that is:
    -----------No. of Occurances
    Item 1-------1
    Item 2-------1
    Item 3-------1

    I'm guessing you are curious about the way they did COUNTIF and what "Indicator" is. If you unhide all columns in the Workouts table, you'll see a column D with the header "indicator". The reference to "Indicator" in the COUNTIF functions refers to the entire column. There is a fairly long formula in the cells of that column but, basically, it just populates it with 1-3 depending on what you pick in the Activity popup.

  • Need to determine how to specify a time range in the COUNTIFS criteria

    I'm using the following formula to identify individuals in a list of individuals performing  a task and categorizing the time they complete it in: =COUNTIFS($A:$A,"someperson",$D:$D,G1) , where G1 is <=4:00:00.  What I what do
    do is have G1 define a time range such as: equal to between 4:00:00 and 8:00:00.  I just can't figure out the proper syntax.
    Any help would be appreciated

    =COUNTIFS($A:$A,"someperson",$D:$D,">=4:00",$D:$D,"<=8:00")
    or 
    =COUNTIFS($A:$A,"someperson",$D:$D,">=" & G1,$D:$D,"<=" & G2)
    Where G1 has 4:00 and G2 has 8:00 
    or
    =COUNTIFS($A:$A,"someperson",$D:$D,">=" & G1,$D:$D,"<=" & G1 + 4/24)
    where G1 has 4:00 and you want a 4 hour window.

  • How do I add to "=COUNTIF(Indicator,1)" formula in Workout Tracker Template

    I'm using the Workout Tracker template to create a chart that counts each time I've selected different items in a pop-up menu. When you pull up the Workout Tracker template there are four sheets. I'm concentrating on the 1st sheet called Summary. I changed the pop-up menu in the "Workouts" table to a choice of colours (instead of the different workout choices) and then changed the "Workout Summary" table accordingly.
    The original template only had an option of 4 items to count in the workout summary, so I added 2 more lines and copied the formula, adjusting the numbers.
    So, the formulas that work are as follows:
    Blue =COUNTIF(Indicator,1)
    Red =COUNTIF(Indicator,2)
    Yellow =COUNTIF(Indicator,3)
    Purple =COUNTIF(Indicator,4)
    My 2 new rows of formulas that aren't working look like this:
    Orange =COUNTIF(Indicator,5)
    Green =COUNTIF(Indicator,6)
    I don't understand where this "indicator" thing is pulling information from so that I can assign 2 more values (5 & 6). It seems that whatever value I put into the 1st column in rows 2-5 it'll adjust itself and read the new count. But nothing happens when I try anything in rows 6 and 7, nothing happens.
    Please help!
    Modified Workout Tracker: !http://i288.photobucket.com/albums/ll196/vvlopez/Screenshot2010-05-01at23904PM .png!

    Select the table "Workout" and unhide its 4th column.
    It's the one entitled "Indicator".
    Useful tip :
    When you must work on a document using the headers to name rows and columns, disable the function allowing that so you will see the standard references. Here, Indicator means : *_Workout :: D_*
    Yvan KOENIG (VALLAURIS, France) samedi 1 mai 2010 22:56:51

  • How do I make a cell reference the condition in a COUNTIF statement?

    I have a formula:
    =COUNTIF(Funds Under Management by Client :: D2:D91,">3.0")
    However, I want to replace the condition '3.0' with a reference to another cell eg B2 so that I can play around with different values and have them immediately reflected in the COUNTIF total. Problem is, I can't find the right syntax to achieve this. I want the formula to actually look something like this:
    =COUNTIF(Funds Under Management by Client :: D2:D91,">B2")
    Is this possible, and if so, how do I do it? Making the formula refer to a cell saves me from having to manually change 90 odd cells in the spreadsheet every time I want to vary the criteria.
    TIA
    Message was edited by: Basilisk

    Fantastic! That worked great. Many thanks for your help. Simple when you know how!
    Message was edited by: Basilisk

  • Two columns + countif

    Hi,
    I'm trying to get some data from one table into another and count the occurences of a text using countif and get the matching amount with it.
    and get the total of the amount based on all occurences
    example
    table 1
    name
    amount (dollar/euro)
    Jeff
    50
    Max
    100
    Jeff
    25
    Elisa
    40
    table 2
    Name
    No. Transactions
    Total (dollar/euro)
    Jeff
    2
    75
    Max
    1
    100
    Elisa
    1
    40
    So anyone suggestions on how to proceed?

    you can use countif() which will look at a range of cells (which you provide as the first argument) and checks with a condition which you include in the second argument.
    You can also use a realted function to add up the transactions for each person-- sumif().  SUMIF() takes three arguments, the range of cells to check, the condition and what to sum.
    below is my "rework" of your original tables using these formulas:
    The formula in Column B2 = =COUNTIF(Table 3 :: $A , "="&A2)
    copy this formula down the column by hovering the cursor over the bottom-left corner of the cell to expand, then click, hold, and drag down.
    Cell C2 = =SUMIF(Table 3 :: $A, "="&A2, Table 3 :: $B)

  • Countif formula, how to make it not count a value if another cell is a certain value.

    I have this formula below:
    =IF(A21="","",IF(COUNTIF(G21:G50,">0"),"A","B"))
    I would like to tell it that if a corresponding row in column B has a value of: "Calibration" then to ignore that row and do not add the value to the countif.
    I thank you in advance for any help you can provide!
    Dustin Shepard

    Hopefully, this will do it:
    =IF(A21="","",IF(COUNTIFS(G21:G50,">0",B21:B50,"<>Calibration"),"A","B"))
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Any idea why in Numbers my COUNTIFS formula keeps breaking? For daycare purpose, I use a spreadsheet that helps me to count how many children I have at 3:15, 4:15 and 5:00. COUNTIFS works well when I create it but breaks after a while. Also I am using a p

    Any idea why in Numbers my COUNTIFS formula keeps breaking? For daycare purpose, I use a spreadsheet that helps me to count how many children I have at 3:15, 4:15 and 5:00. COUNTIFS works well when I create it but breaks after a while. Also I am using a pop-up menu in the cells in time format, does it have any consequence on the formula?

    Any idea why in Numbers my COUNTIFS formula keeps breaking? For daycare purpose, I use a spreadsheet that helps me to count how many children I have at 3:15, 4:15 and 5:00. COUNTIFS works well when I create it but breaks after a while. Also I am using a pop-up menu in the cells in time format, does it have any consequence on the formula?

  • Countif function help

    Having difficulty with the Countif function.
    This works:=COUNTIF(Focal Length,B2)  (gives me the count of numbers equal to 14 which is in B2)
    and This works:  =COUNTIF(Focal Length,">14") (gives me the count of numbers greater than 14)
    but this does not:=COUNTIF(Focal Length,>B2)
    Nor does this: =COUNTIF(Focal Length,">B2")
    the two that don't work give an error saying there is a syntax error as opposed to an incorrect count.
    At a loss as to what I'm doing wrong.  B2 does contain the number 14 (formatted as a number)
    For what it's worth analyzing some EXIF data pulled from Aperture, looking at the most common focal lenght I use. 
    Any help appreciated,
    Thanks
    Rick

    Hi Rick,
    The 'condition' in SUMIF must be expressed as a text string.
    ">14"         works because the text string correctly expresses the condition 'greater than 14'
    >B2           fails because the operator ">" is not interpreted as text, as required.
    ">B2"        fails because  "B2" is text, and is not interpreted as a cell reference.
    ">"&B2     works because the text string ">" and the result returned by the cell reference B2 (14) are joined by the concatenation operator & into the text string ">14"
    All very complicated (at least until you've written a few SUMIF statements).
    Regards,
    Barry

  • Using COUNTIF with a range of numbers

    Hi, This has been bugging me for a while - and hopefully you can help
    I am counting the scores a particular set of children are getting in a test. I need to count how many of these children get between 4.5 and 5.5
    I've been trying with the below expression - but it does not work! How do I express between 4.5 and 5.5?
    COUNTIFS(Data::$B$3:$B$33,FALSE,Data::I$3:I33,">4.5,<5.5")÷COUNTIF(Data::$B$3:$B $33,FALSE)

    Hi Gwyn,
    Columns C to H are hidden to make a smaller screen shot.
    Column B all cells are FALSE (unticked) to keep this simple.
    The result appears in the Countifs table with this formula in A2:
    =COUNTIFS(Data::B,"=FALSE",Data::I,">4.5",Data::I,"<5.5")
    Note the Header Row in the Data table to allow reference to all Body Cells (for example, Data::B instead of a specific range of cells). That will allow you to add or delete rows, and the COUNTIFS formula will still work
    The syntax for COUNTIFS is (from the Functions Panel)
    COUNTIFS(test-values, condition, test-values…, condition…)
    Regards,
    Ian.

  • VLOOKUP and COUNTIF funtion in BOXI

    Hi,
    I am new to Business Objects, so I have very basic knowledge in it. What I am looking is to create some formula like VLOOKUP and COUNTIF function as in excel.
    I have two queries:
    Query A: List of all old clients
    ClientIDs- 123,124,124
    ContactDates-01/04/2010,02/04/2010,01/04/2010
    Query B: List of clients during some reporting period
    ClientIDs: -123, 125,124,126
    What I want to do is to identify the old clients in QueryB - and pull the Contact Dates from the Query A to query B. Also the other issue I am facing is because ClientIDs are linked, when I create some funtion it is also populating all the ClientIDs in Query B report which I don't want to happen.
    Hope I was able to explain it you
    Many Thanks

    Hi!
    Okay I did retest this.
    if you have following setup:
    Table A
    client_id     Contact_dates
    123     01.04.2010
    124     02.04.2010
    124     01.04.2010
    Table B
    client_id     info_id
    122     122
    125     125
    124     124
    126     126
    then you can do this via Desktop Intelligence - If you have the possibility to change the universe or sql - you should try to do there your stuff.
    So basically you create a dataprovider for Table A : Client_ID .. Dimension, Contact_Dates .. Information for Client_ID.
    For Table B: Client_ID .. Dimension, Info_ID .. Information for Client_ID
    Now you can join the Client ID from Table A and B.
    Create a report table in Deski with following columns:
    Client ID ; Contact Dates (where contact dates is filled with this variable: =Max(<Contact_dates>))
    Add a variable: = If (IsNull(<info_id>)) Then 1 Else 0
    Now add a filter on the table: where the variable is 0
    Now you will only see the Clients in Table B and for each client ID you will have only one entry.
    I hope this is what you wanted to find.
    ciao

  • Using countif for multiple ranges

    I have a spreadsheet where I need to count a value in several ranges in the same column. Can't figure out how to do it

    You can't have non-contiguous ranges but the range can include blank rows. I mention that second part because I don't know what is between your ranges.
    You either need to use multiple COUNTIF functions or duplicate the data in another spot (such as another table) where you can make it all one big range (with or without blank rows). The table will simply be a bunch of formulas like =Table 1:: B2

  • Sorting messes up formulas such as countif

    I like to use CountIF in the Windows version of Excel to enumerate items in a list and quickly pick out the first unique item to shorten lists of mostly duplicate information. But it seems that Numbers is not as robust in this practice of mine.
    To demonstrate, create a list of random letters (making sure some of them are duplicates). In cell b2, create the following formula: =COUNTIF(A$1:A2,A2), and fill down. You should get something like this:
    Note how the countIF formula changes for each row. This is expected.
    Now I sort Ascending by the Letter collumn.
    and then I get this mangled form:
    which is just about useless. The expected form of the formula for it's new location in the list should be =COUNTIF(A$1:A8,A8). You can even see how the new formula has the exact same "selection" from before, but it's all mangled and cut up in such a way that even Numbers itself can't understand.
    Numbers 09, version 2.0.2 (322)
    I also filed this as a bug report on the Numbers Feedback page.
    -Mike

    I do not know when I'd ever want references to be linked to the exact cell.
    Since I'm a Desktop Support tech, I like to get used to many programs that do similar functions and try to solve the same problems in each so I'm not tied down by any one option. But this turned out to be a problem that was not supposed to be one.
    The problem I see is that Numbers allows Excel importing, but does not respect this behavior. I understand the argument that Apple wants to do it their way, but even OpenOffice.org doesn't have this issue (although you have to get used to using semicolons instead of commas). Google Docs also behaves the same as Excel and OOo in this matter. I'd be shocked that any other spreadsheet application with Excel document support would do this sort/cell-reference issue "the Apple way".
    Indirect is a function in Excel too. It's useful for conditional formatting with a formula that looks at data in only one column.
    But, without the ability to easily generate letters based on the column number or any sort of visual reference to what I'm referring to, I see it's use here to be vulgar. If this is the way Apple wants to do spreadsheets, I'll resort to another option. This really hurts my feelings as a customer, because I bought iWork 08 and now 09 with the hopes it would be a reasonable MS Office replacement. I really wish Claris Works still existed or that they'd based iwork of CW's code.
    But then again, I dislike FileMaker enough that I'd rather learn MySQL.

  • CountIf Expression for Report Builder 3.0

    Hi everyone!
    I have been trying to create a countif type expression in a table to count the number of items that have the status "Complete". I used one i found from a previous conversation, {  =sum(iif(Fields!Status.Value="Complete",1,0)) 
    } but this gives the wrong output.
    Can anyone help me with something that will count the number of items that are marked as Complete in the status field?
    Thanks for your help in advance!
    Allana

    Hej!
    Test the following expression and let me know if it works.
    =COUNT(IIF(Fields!Staus.Value="Complete",1,Nothing))

Maybe you are looking for

  • Remediation Role

        NAP is declared deprecated by Microsoft. Don't know if that means, subsequent discontinuity of the feature or not evolved further but remain supported or means not available in newer iterations or versions of windows.     What's the plan about th

  • Servlets and JDBC - Best Way to Create Connections?

    Hi, I have a very simple servlet that executes a query and returns the result for a true/false test. The connection is created when the servlet is initialized: public void init(ServletConfig config) throws ServletException { dbConnection(); //Creates

  • BPM DCs for NWDI Track

    Hi, I am working on CE7.2 on BPM. I am customizing SAP MDM DCs using NWDI and using these DCs in BPM process. So I would like to know whether do I need to add any build time BPM DCs to my track? If yes, please let me know the file names to add my tra

  • Oracle messenger web interface

    Does Oracle messenger has an interface that can be integrated with a Portal page? Essentially, the need is to have a messenger window always available within a portal/web page instead of invoking the client for sending/receiving messages. If Oracle m

  • Modify data types

    Using Test Stands DLL prototype adapter to call a shell interface DLL of my own creation, I have found an irritating problem with the data types loaded from my type library. Character arrays default to Category: "Array of Numbers" Type: �Signed 8-bit