Counting Observations Under Given Condition
Oct 20, 2009
I'm trying to get 3 formulae for calculating days in drawdown…
Column A has daily dates and Column B has drawdowns which are either a negative number or 0(which means there is no drawdown)…
Every drawdown period starts with a negative number, and as long as the numbers continue negative the streak continues until it is stopped with a zero.
1. Need - Longest period in drawdown….this should basically be the most number of consecutive negative values in Column B (before the streak being interupted with a 0)
2. Days in Current drawdown - this is the most recent streak of negative numbers, in our case the answer is 10 as shown in column F. (hopefully formula detects the date and figures this out)
3, Days in Maximum drawdown - this is the negative streak which had the lowest value…….in our case I believe its about 292.
View 6 Replies
ADVERTISEMENT
Aug 9, 2009
I have a range, intervals and need to find out how many observations are in those intervals...
RANGEINTERVALFREQUENCE-0.10773-0.10773-0.11 ?-0.10144-0.11 -0.05 -0.0983-0.05 0.01 -0.085110.01 0.07 -0.0810.07 0.13 -0.078760.13 0.19 -0.07580.19 0.25 -0.071360.25 0.31 -0.070750.31 0.37 -0.06930.37 0.43 -0.068420.43 0.49 -0.068060.49 0.55 -0.067390.55 0.61 -0.060030.61 0.67 -0.059350.67 0.73 -0.057470.73 0.79 -0.05290.79 0.85 -0.052570.85 0.91 -0.05190.91 0.97 -0.051340.97 1.03 -0.050011.03 1.09 -0.048051.09 1.15 -0.046941.15 1.21 -0.046411.21 1.27 -0.045311.27 1.33 -0.045291.33 1.39 -0.045061.39 1.45 -0.045021.45 1.51 -0.044341.51 1.57 -0.043321.57 1.63 -0.042231.63 1.69 -0.041661.69 1.75 -0.041441.75 1.81 -0.040051.81 1.87 -0.038661.87 1.93 -0.038561.93 1.99 -0.037811.99 2.05 -0.037112.05 2.11 -0.036272.11 2.17 -0.033292.17 2.23 -0.032872.23 2.29 -0.032672.29 2.35 -0.031322.35 2.41 -0.029372.41 2.47 -0.029262.47 2.53 -0.028292.53 2.59 -0.028222.59 2.65
View 9 Replies
View Related
Sep 11, 2012
I would like to write a macro that would count observations from a database extract based on specific conditions and generate a report.
My database extract looks like this :
Client name
Info1
Info2
Info3
Bob
aaa
aaa
aaa
[Code] ....
I would like to have an efficient and simple VBA code to count the observations. Something that would store the result of query like those:
# 'client name' = Bob : 2
# 'client name' = Bob AND info1 = aaa : 1
# Info3 = bbb : 2
# 'client name' = Bob and Info1 = aaa OR Info1 = bbb : 2
I am aware of DCOUNT function, but I am not too sure how to translate it in VBA. I also think that using autofilter and counting the visible rows may be subject to bugs.
View 9 Replies
View Related
Sep 24, 2009
I have a few dozen columns of data and would like from each row to count the number of negative numbers in every 3 occurrences. E.g. in row 2 I’d want to count the negative occurences in B2, E2, H2, K2 etc. Also, I’d like to be able to count the total number of occurences along each row, again counting every 3rd occurrence, though this time both negative and positive values.
View 4 Replies
View Related
Jun 1, 2009
I have a range of ten cells (B4:K4), some of these cells contains dates, and other cells contains text, what I want is counting number of cells that contain dates earlier than today's date. I actually tried the following code, but it returns zero value.
View 2 Replies
View Related
Sep 24, 2009
I have three columns of data
Col-A-----Col-B------Col-C
1---------(blank)-----a
3---------A----------b
1---------A----------b
2---------B----------c
2---------(blank)-----c
4---------D----------a
3---------E----------a
1---------A----------b
3---------B----------c
I am trying to calculate two things:
first, a simple count of entries (non-blank) in Col-B corresponding to 'a' in col-C. Ex. for Col-C='c', the no of entries in Col-B is 2. Here I was trying SUMPRODUCT(--(Col-B range""),--(Col-C range="a")) with CTRL+SHIFT+ENTER. It doesn't work.
second, a more complex count without repetitions. Ex. for Col-C='b' and Col-B='A', the no of entries in Col-A is 1, because there are two 1's. If there would have been three 2's and four 3's the count would be just 2.
View 9 Replies
View Related
Apr 2, 2012
I need to be able to count items if they match a condition in another column, as below
A B
1 Apple Red
2 Apple Green
3 Apple Red
4 Pear Green
5 Apple Red
6 Pear Green
7 Pear Red
8 Apple Red
How can I count how many Red Apples there are. The answer should be 4 but when I use countifs I can either count the no of apples in Col. A or the no of colour Red in Col. B.
I have tried every combination of if, vlookup, and count that I can but keep getting errors or single col. counting.
View 3 Replies
View Related
Aug 21, 2014
Formula which will count unique values in column A based on condition in Column B which "y" .....
Show ranges as A:A instead of A1:A100 as I dont know the size of the table, it can be thousands rows .....
View 3 Replies
View Related
Sep 6, 2005
Counting Unique text entries in a sheet with a condition ..
View 14 Replies
View Related
Mar 24, 2014
I am trying to perform a calculation in a cell that leaves the value 0 if before Feb 2014, changes to the value of another cell in Feb 2014 and leaves the value unchanged if after Feb 2014. I can get to the Feb 2014 value but after that month the value changes to 0.
The Cell formula that I am trying to use is as follows:
=IF(YEAR($A$3)<2014,"0",(IF(YEAR($A$3)>2014,H114,(IF(MONTH($A$3)<>2,H114,AA118)))))
A3 contains TODAY()
H114 is the cell being calculated
AA118 is the cell containing the calculated value for the current month.
View 2 Replies
View Related
Aug 13, 2009
I would like to try and achive a conditional format that will require a lookup function. when the condition is met it places Yes or No into a cell and changes that row colour to red for the NO condition. and after 10 days from now the rowcolour is removed.
View 6 Replies
View Related
Jan 1, 2014
I cannot get various formulas (Countif, Match, Frequency, Etc) to work properly.
I am trying to arrive at a total number of matches of numbers in cell range B1:G1 with any numbers entered into the cell range of K1:P11 and have the total of matches display in cell H1.
However I do not want to count duplicate numbers from the K1:P11 cells. (if the number 5 in posted in K1:P11 multiple times I only need it reported once in H1)
B1:G1 is the constant and the numbers will not change - K1:P11 cells will be populated by adding numbers until the all the numbers in B1:G1 is completed and match.
Range
B1 C1 D1 E1 F1 G1
2 7 19 45 22 13
H1 Total of matching numbers in cell range K1:P11
View 3 Replies
View Related
Feb 29, 2008
I'm having trouble with the two formulas working in conjuction with each other.
Condition 1:
=(MOD(ROW(),2)=0)*(COUNTA(3:3))
Condition 2:
=TODAY()>=A1
"Condition 1" seems to override "Condition 2"? Ever see that?
View 9 Replies
View Related
Apr 12, 2014
So I have one sheet that needs to pull data through to another sheet (which is a stats summary)
I have a drop down list containing 4 options all of which have to be counted separately on the stats summary sheet. However I only need them counted when a value is input in another cell in that row.
For example: I select option 1 from down down menu, but I only want this to be counted on the stats page when I enter a date in the "date" cell.
View 9 Replies
View Related
Jan 15, 2014
Here's a simplified example:
ColA
ColB
ColC
Row1
A
Y
A
Row2
B
N
D
[Code] .........
I'm looking to return the values in column A adjacent to the cells in Column B equal to "Y". The kicker has been returning only the cells where the condition is true. Column C displays the desired behavior.
The closest I've been able to get is with a simple IF statement but I'm pretty sure the answer is a far cry away from there and likely requires an array formula. I'd prefer not to use VLOOKUP or OFFSET but will if the alternative is very complex.
View 7 Replies
View Related
Feb 3, 2014
I was given this spreadsheet to count attendance by entering the entry date and exit day, however it's counting the first day and the last. I'm needing it to only count the first day and not the exit day.Book2.xls
View 1 Replies
View Related
Feb 2, 2014
I need cell (O4) to display days overdue or days remaining on an assigned task based on subtracting due date (M4) from todays date, but only perform days subtraction function if (M4) is not blank and only if task complete cell (N4) is less than 100.
Have the conditional blank cell figured out, but nesting another condition for the less than 100 complete cell. So in other words, I don't want cell (O4) to subtract days and display any error, irrelevant data if there is not any due date entered or the task is entered as complete...
View 3 Replies
View Related
Jun 28, 2009
I have a rows of the following.
=IF(H1="","",IF(H1="Fail","1",IF(H1="Pass","2","3")))
=IF(H2="","",IF(H2="Fail","1",IF(H2="Pass","2","3")))
=IF(H3="","",IF(H3="Fail","1",IF(H3="Pass","2","3")))
=IF(H4="","",IF(H4="Fail","1",IF(H4="Pass","2","3")))
=IF(H5="","",IF(H5="Fail","1",IF(H5="Pass","2","3")))
The following are the outputs.
1
2
2
2
1
When I do summation on the output cells, the results returned 0. Do I have to do anything procedure in order to add up values that are generated by If-Else?
View 4 Replies
View Related
Feb 10, 2010
3 different condition using IF. See the attachment.
View 2 Replies
View Related
Oct 23, 2008
I need to find the last date when a company bought any product from my company.
So i have taken the export from the CRM, now i want if the company name collumn is same take the max function in the date collumn fro that perticular company.
I am attaching the file also with a small example.
View 10 Replies
View Related
Dec 11, 2005
Is thre an easy way to set up the following testing conditions:
- if A1=A2=A3= ... =A10, do something?
--
Additional information:
- I'm using Office XP
- I'm using Windows XP
View 9 Replies
View Related
Nov 12, 2009
I have 3 columns. Column A contains numbers, column B names and i would need columns C to contains the sum of the numbers of column A if they have the same name in column b. I have made an example to make it easier to understand so here is a printscreen of what column C would need to look like: http://img441.imageshack.us/img441/3417/57644131.jpg
View 5 Replies
View Related
Apr 16, 2009
Been teaching myself VBA and I've gotten stuck, and no matter how I search I can't seem to find an answer...
Trying to set up a condition is vba where if a cell value minus another cell value is greater than a static value (elsewhere in the sheet), then to turn the font green.
Code so far:
Dim Cval As Integer
Cval = Cells(3, 6).Value
FinalRow = Cells(65536, Cval).End(xlUp).Row
For i = 10 To FinalRow
If Cells(i, Cval) - Cells(i, Cval + 1) > R6C5 Then
With Cells
.Font.ColorIndex = 10
.Font.Bold = True
End With
End If
Next i
End Sub
I can't work out the right sintax to get a if condition to work correctly.
I have gotten this to work with conditional format, but if you want to copy/paste elsewhere, it doesn't paste the format result correctly...
View 9 Replies
View Related
Jan 22, 2007
Need VBA code to sum total all entries that are in range F7:H70 that are 600.00 or over into a variable called lng1099sTotal. For example:
......F....G.....H...
7..125..610..850
8..900..301..425
9..984..325..600
lng1099sTotal should equal 3,944.00
(610+850+900+984+600).
View 3 Replies
View Related
Jan 8, 2009
I am looking for a formula that will count days in increments of 1 through 40. I need it to look like this: DAY 1 of 40
Whereas only the "1" counts up to 40 every 24 hours. And maybe a button to reset the counter back to "1" ...
View 6 Replies
View Related
Nov 26, 2013
want to count up from a certain number but rather to a certain number.
Basically I am making a spreadsheet of products which already have product ID's, however there are 1000's of these. So I am doing them by manuafactuer, so some sheets do indeed start from 1, but pretty much every other sheet starts from a number like 1300, or even 2563.
how I would go about making excel automatically fill in the ID field?
So it would show like;
1300
1301
1302
etc etc
View 2 Replies
View Related
Nov 6, 2005
i use a excel sheet to count the points gaint in an competition with model sail boats ...
View 13 Replies
View Related
Jul 5, 2012
There are 5 sellers and their sales are captured in an individual sheet for each one. Also there's a general sheet where all the sales from all the sellers can be seen.
Now, each seller receives a commission of 5% for each sale he makes. However, when the sum of all the sales of all the sellers is greater than a predetermined goal (let's say 1000 USD), the commissions change to 7% instead of 5%.
IMPORTANT: The seller only receives 7% of commission from the sales made AFTER the goal was reached, the ones before are paid at 5%.
So I need to be able to split the sales in the end to know which were made before and after the goal was reached, so that the commissions are paid correctly.
View 4 Replies
View Related
Apr 7, 2014
I am trying to arrive at the results in the yellow cells without needing the blue cells inbetween.
A sumproduct would be best but the 2nd row of blue cells has an if statement in it.
View 3 Replies
View Related
Dec 19, 2013
potential VLOOKUP (or possibly another function)
I have a table with about 14 columns, and need a VLOOKUP based on column A.
The problem is Column A has 2 of each unique ID - but column B is the subtype.
For example
Column A Has names (Bob, Jim, Steve, etc) Column B has Opt in or is blank (if they opt out the cell is blank if they opt in the cell says Opt in)
So essentially it's like a vlookup - as i need to read across the columns based on the name, but i also need to check column B if they have opted in.
View 1 Replies
View Related