I couldn't find a matching answer already but happy to be redirected!
My issue is with countifs across two worksheets but I can replicate it in a smaller environment.
I have three columns of data (A-C): -
Column D has the formula =IF(A2="Closed",C2-B2,0).
That bit works, I now need to count how many took X number of days to close: -
Column G has the formula =COUNTIFS(A2:A11,"Closed",D2:D11,F2)
Looking at the pictures 41 and 49 should have a count of 1 right? What have I done wrong? All cells are formated as numbers.
Your formula in column G uses an absolute comparison to the value in column F.
The problem is that none of your values exactly match that value.
The duration column is formatted to show a value rounded to a day, but the underlying value is not the same as what is showing in the formatted cell.
Therefore, the formula in column G needs to factor in a range of values like this:
=COUNTIFS($A$2:$A$11,"Closed",$D$2:$D$11,">="&F2,$D$2:$D$11,"<"&F3)
In words: count all the cells where column A shows "Closed" and where the value in column D is between the value in F2 and the value in F3.
You will need to add an extra value in column F for anything above your biggest number in column F.
Check you output in Column D. It must be having decimals. If that is the case, you need to round the formulas in column D using ROUND formula.
=ROUND(IF(A2="Closed",C2-B2,0),0)
Rows 4 and 7 have status as "Open" and hence won't be counted by Countifs, i. e. change value of cells A4 and A7 to "Closed" to see updated results.
Also, fix your range $A$2:$A$11, etc. when using Countifs
Related
The formula should sum up the column C based on Column A and B when two column value matches and displays the sum value only in the first cell D2 of Column D as shown in figure "60" & "67".
I am trying with SUMIFS but not getting the Output as required.
=SUMIFS(C2:C6;A2:A6;"A:A";B2:B6)
Try this formula in cell D2:
=IF(SUMPRODUCT(--($A$2:$A2&$B$2:$B2=$A2&$B2))=1,SUMPRODUCT(--($A$2:$A$6&$B$2:$B$6=$A2&$B2),$C$2:$C$6),"")
It should give expected output.
It might also be better/more efficient if you create a helper column (which stores concatenation results, instead of doing the concatenation multiple times in each formula).
I have a work sheet in which there are several cells with a specific entry - let's say "A". These are not all in the same rows/columns. After each cell is a date.
I need to count the number of cells containing "A" which also have a specific date in the cell immediately to its right. I've tried combinations of Countifs and Indirect, with no success. How can I achieve this?
This counts the number of times that there is A in column A and 1 in column B
=SUMPRODUCT(($A$1:$A$5="A")*($B$1:$B$5=1))
This outputs in cell D1
Not too difficult.
I have created a sample sheet with 8 rows and 5 columns of data.
See below, the formula in cell C12 counts the number of occurrences where the a cell with a date of October 31, 2017 is directly to the right of a cell that contains the text A.
If you want more info as to how this works, read on:
When searching for cells that contain A, you don't search in the last column of the data (in this case, column E) because it is impossible for a column to the right to have any date in it. This is why a portion of the formula says A1:D8="A" instead of A1:E8="A". This is the same reasoning why we start searching for a date in column B rather than column A in the formula.
You can achieve this with a helper row. Add additional row on top of your Worksheet. In cell "A1" enter formula below.
=COUNTIFS(A2:A2000,"A",B2:B2000,"YourDate")
Drag this formula to the rightmost of where you have data, then simply sum all values returned by formula.
Screenshot of the Excel worksheet
I'm working with historic stock prices, and using eight columns I have:
Column A: High
Column B: Low
Column C: Close
Column D: Cx-Cx-4
Column E: Counts the number of consecutive positive numbers in column D
Column F: Counts the number of consecutive negative numbers in column D
Column G: Calculate the difference between the maximum of column A and minimum of column B within a given sequence.
As an example G1 should equal:
=max(A1:A5)-min(B1:B5)
G6 should equal:
=max(A6:A8)-min(B6:B8)
G9 should equal:
=max(A9:A11)-min(B9:B11)
And so on.
I'd like to know if it is possible to automate this calculation, possibly with the use of one or more additional columns.
Welcome to SO!
This may not be the most efficient solution as you need to add two helper columns, but if I understand your requirements correctly, then this idea should work well enough.
First, let's assume that there are 100 rows in your data set. Given that, enter the formula "=A100" in cell G100 and the formula "=B100" in cell H100. This sets up the boundary condition for the formulas in columns G and H. Now, in cell G99, enter this formula:
"=IF(E99="",G100,IF(E100="",A99,MAX(A99,G100)))"
What this formula does is set up a "running maximum" with the following logic:
If the cell in E99 is blank, copy the running maximum from G100, else:
If the cell in E99 is not blank but the cell in E100 is, set up a new running maximum from the cell in A99, else:
Take the maximum of A99 and G100 as the new running maximum.
Similarly, copy the following formula into cell H100:
"=IF(F99="",H100,IF(F100="",B99,MIN(B99,H100)))"
This follows the same logic as the previous formula, but takes the minimum of column B.
Copy or autofill these formulas to the top of the data set. This should now give you running maximum for column A and a running minimum for column B.
The next step is to calculate the difference. I notice from your question, that you only seem to be interested in calculating this difference at the top of each range (G1, G6, G9, etc.), rather than doing it in every row. Given that, we need a slightly more complicated formula.
The boundary condition for this formula is simply "=G1-H1" entered in cell I1. In cell I2, enter this:
"=IF(OR(AND(E2<>"",E1=""),AND(F2<>"",F1="")),G2-H2,"")"
How this works is that it check two conditions that indicate a range boundary:
E1 is blank and E2 is not
or
F1 is blank and F2 is not
If either of these conditions hold, the IF statement is true and "G2-H2" is diplayed, otherwise a blank cell is displayed. Now copy or autofill this formula to the bottom of the data set.
As a final step, you can now hide columns G and H if you don't need them displayed. This should now give you the results I think you're looking for. Please let me know if this doesn't work out for you.
I'm new to Excel. I'm looking for formula to perform the following.
Column B has values like TM, LA, Break etc. And Average Handling Time (AHT) will be captured in Column E. Now I need Average AHT for the values in Column B. Ex: If Column B has 6 "TM", then their respective time in Column E should be Averaged. This Avg value will be in Cell G4. Similarly I need Avg AHT time for other values in Column B. Can someone help me in this..
Please Refer to the attached Image above
AVERAGEIF
Use the AVERAGEIF function.
Place the following formula in G4 and copy to the right:
=AVERAGEIF($B$4:$B$15,RIGHT(G$3,2),$E$4:$E$15)
Format G4 and H4 to the desired time format or you will see a decimal number.
Proof of Concept
Explanation:
The AVERAGEIF function has three arguments
=AVERAGEIF(A, B, C)
A: Range of cells that has you criteria in it
B: What your criteria is
C: Range of cells to take the corresponding average of
In this case A is $B$4:$B$15. The cell addresses have been lock with the $ to prevent them from changing when the formula is copied.
For B we used the RIGHT(G$3,2) formula. This pulled the last two characters from your header above. Only rows in B that match the last two characters of the headers will be used for the average calculation. Alternatively, this could have been hard coded as "TM" or "LA"
For C, the times in the range $E$4:$E$15 were supplied. The values that match were added together and then that sum was divided by the number of matches to get the average.
I'm having an issue getting accurate data from the SUMIF function. This appears to be caused by the SKU and Product name being identical however I don't understand why the selected range would be ignored.
SUMIF(G:K,A2,K:K) - Cell D2 is calling for the sum of K yet returning the sum result of K2:M2. All other results in D are correct.
SUMIF(G:K,A2,I:I) - If I change the formula in D to SUM I:I (text not a numeric field) the function returns the sum of K:K
Example file http://tempsend.com/013C2B6378
According to the documentation here the range to be summed starts at the top left of the sum range (K:K in your first example) but its size is given by the size of the criteria range (G:K in your example). So I think that's why you're getting extra columns summed in your result.
If you have multiple criteria involving different columns, you should be able to use SUMIFS.
So let's say your data sit in 8 rows (including the headings).
then you simply need to change your formula to say, look for B2 in column G OR in I, if true, then sum the values in K. Right?
put this formula in B2 and press ctrl+shift+enter to calculate the formula.
=SUM(IF(($G$2:$G$8=B2)+($I$2:$I$8=B2),1,0)*$K$2:$K$8)
then drag and fill down until the last cell.
obviously you need to adjust the ranges in the formula to adapt to your own data.
tell me if you get to the answer via this.