Hi I have a row of calculated values that I need to count based on a condition.
I have the conditions working in conditional formatting so that is the condition is met the cell changes color, however I need to find the totals of each color.
=AND($V1/$Z1>0.5, $V1/$Z1<=0.79)
so for this I want to only count values if this statement is true
=COUNTIF(Z:Z, (AND($V1/$Z1>0.5, $V1/$Z1<=0.79)))
currently this returns 0 when there is 10 values that meet this criteria
does anyone know if countif can be used like this?
I can see your issue, I've had a play around and am unable to crack it, if you wish to keep it in a singular cell you'll probably need to go down the route of an array formula. Its probably complicating it too much and you should look to have a helper column,
in Column AA, have the formula =$v1/$z1, then for your count write:
=countifs(AA:AA,">0.5",AA:AA,"<=0.79")
This can be done without a helper column using the Sumproduct() function.
=SUMPRODUCT(--($V$1:$V$100/$Z$1:$Z$100>0.5),--($V$1:$V$100/$Z$1:$Z$100<=0.79))
or
=SUMPRODUCT(($V$1:$V$100/$Z$1:$Z$100>0.5)*($V$1:$V$100/$Z$1:$Z$100<=0.79))
This will count all instances where the values in V1 to V100 divided by the values in Z1 to Z100 are between 0.5 and 0.79
Note that SumProduct is essentially an array formula (even though it does not require confirmation with Ctrl-Shift-Enter, but it evaluates each range as an array), so you don't want to use it with whole column references. If you want to retain calculation speed, make sure to refer to used rows only, not gazillions of empty cells.
Related
Im trying to count the duplicated values between the 2 row so im using the formula as you can see it in the image =SUM(COUNTIFS(E4:S4,{"1","2","3"}))
so I have to write the numbers so I dont want write the numbers I want select the cells instead, any formula would do that? I already searched and tried many things but nothing seem to work
Put those values in cells - and refer to those cells as condition.
Next level: insert those values in a table, that you eg. call FilterBy and the column values
Then you can us this formula:
=SUM(COUNTIFS(E4:S4,filterBy[Values]))
Hat I don't understand: why are you using SUM - like this, it doesn't make sense, as COUNTIFS returns one value.
If you want to some all filtered values then you need this formula:
=SUM(SUMIFS(E4:S4,E4:S4,filterBy[Values]))
I'm having a problem writing my formula that should count all selected cells that contain a number bigger than 0 and skip the cells that are completely empty, even when the cell is selected. Excel gives me an error that I selected cells that not contain a number. How can I skip them?
This is my formula:
=COUNTIFS(C8:C12;E8:E12;G8:G12;I8:I12;K8:K12;">0")
I'm thinking you using the COUNTIFS() formula wrong, after each range, there is a criteria. You can't have multiple ranges like that to look through. For more information look here or here.
In your case you are dealing with a non continues range, and one way to deal with that would be this
So the formula would translate to:
=SUM(COUNTIF(INDIRECT({"C8:C12","E8:E12","G8:G12","I8:I12","K8:K12"}),">0"))
Another formula you could try is:
=INDEX(FREQUENCY((C8:C12,E8:E12,G8:G12,I8:I12,K8:K12),0),2)
And looking at your data, it seems as though the rest of the columns contain text (not sure, they may be dates). In case they are text values:
=SUMPRODUCT((ISNUMBER(C8:K12))*(C8:K12>0))
If they are actually dates (assuming from 2018), then you could try:
=SUMPRODUCT((YEAR(C8:K12)<2018)*(C8:K12>0))
I'm assuming this is what you looking for, instead of a VBA based solution due to the tags provided and your formula.
You could also do it in this particular case by skipping the columns that you don't want:
=SUMPRODUCT((C8:I12>0)*ISEVEN(COLUMN(C8:I12)-COLUMN(C8)))
what will be happen if you use the below formula? to you receive an error?
=COUNTIF(C8:C12,">0")+COUNTIF(E8:E12,">0")+COUNTIF(G8:G12,">0")+COUNTIF(I8:I12,">0")+COUNTIF(K8:K12,">0")
Try this
Requirement cannot be done in single formula,
combining 2 or more formula will help fixing the formula.
formula
=COUNTA(B2:B9,D2:D9) -- Count all the non blank cell's
=COUNTIF(B2:B9,"=0")+COUNTIF(D2:D9,"=0") -- Count all the cells will value as 0
Subtract both which will give the output you are looking for
Combined formula
=COUNTA(B2:B9,D2:D9)-(COUNTIF(B2:B9,"=0")+COUNTIF(D2:D9,"=0"))
So I have replicated the error with dummy data here.
I am trying to populate C2:C5 with the totals from the value column in the rawdata table that correspond to the values in B2:B4 multiplied by the looked up values in type table.
when I highlight the respective arrays in the Sumproduct formula and leave them as values they are calculating correctly, but for some reason the formula doesn't work as is.
=SUMPRODUCT(RawData[Value],--($B2=RIGHT(RawData[Vehicle],LEN($B2))),OFFSET(Multiplier[[#Headers],[Multiplier]],MATCH(RawData[Type],Multiplier[[Type ]],0),0))
EDIT:
I have a sumproduct formula with three arrays, the first is a column full of values, the second is a list of bools and the third is a list of multipliers.
The formula is returning 0 even when all criteria are met.
I have identified that it is the third array of multipliers that is causing the problem. If I highlight that section of formula, hit F9 and convert it to values, the whole thing calculates correctly. but when it is left as a formula it is returning 0.
Just in case anyone in the future has a similar issue, I think it's the offset part of the function.
=SUMPRODUCT(RawData[Value],--($B2=RIGHT(RawData[Vehicle],LEN($B2))),OFFSET(Multiplier[[#Headers],[Multiplier]],MATCH(RawData[Type],Multiplier[[Type ]],0),0))
You can in this situation use sumif instead:
=SUMPRODUCT(RawData[Value],--($B2=RIGHT(RawData[Vehicle],LEN($B2))),SUMIF(Multiplier[[Type ]],RawData[Type],Multiplier[Multiplier]))
credit to /u/rnelsonee
/r/excel Thread
The blue cell summates to 1, but that is not correct and it should summate to more because of the row text match with B47 row. Any ideas what's wrong?
SUMIF is not supposed to work with more than one criteria (you can't check multiple criteria within one SUMIF as you tried in your formula).
This formula will calculate the right result for you: =SUM(B3:BI3*(IFERROR(MATCH(B2:BI3,B47:AL47,0)>0,0))), this is an array formula, so you need to press CTRL+SHIFT+ENTER after it.
MATCH(...): look for all students whether they are in the list with requirments (this is the part which works only as array formula)
IFERROR(...): converts #N/A errors to 0
If I am not wrong, you are trying to calculate the number of students for a particular project with skill1 and skill2.
You may also try using COUNTIFS() function. This works for multiple criteria.
I'm working on adding a collection of board games to our library.
I have a spreadsheet that lists more games than I intend to buy, but have them there to investigate. I have the prices for a couple of websites listed beside each game.
The problem is that I want a sum that doesn't include every game on the list. Instead, I want to add a column at the front that if I put an "X" indicating this is a game to get, then I want it to add the value for that. Only the values for rows that start with an "X" in column A will in added together, instead of everything.
I was hoping to do this with a formula instead of just choosing a basic =SUM formula and selecting only a few cells at a time. I assume a =SUMIF might be the answer, but I have yet to figure out how to get this to work.
Please try:
=SUMIF(A:A,"x",B:B)
where B:B is the column with the values. I suspect your difficulty may have been that when using text as the 'trigger' it needs to be in double inverted commas.
Or you might sort by ColumnA and just use =SUM as far down as there are xs.
Or filter on ColumnA to select x and Autosum ColumnB but change the 9 to 109.
SUMIF requires at least 2 parameters, and at most 3. In your case, you will need to use 3.
If you type the formula in excel, you will see a little balloon indicating:
=SUMIF(Range, Criteria, [Sum_Range])
Range is the range where you want to apply the condition, in your case, A:A.
Criteria is the condition applied to the range, in your case "x".
[Sum_Range] is the range to sum, after applying the condition.
The above will sum all the cells in the range [Sum_Range], for which the cells of Range satisfies the condition Criteria.
Translating that into an actual formula, you get pnut's formula:
=SUMIF(A:A,"x",B:B)
The above will sum all the cells in the range B:B, for which the cells of A:A satisfies the condition x (SUMIF considers the criterion as being 'equal' so it will sum only when they are equal to the criteria).
As an extra, you can change the condition to mean 'not equal' by using something like this: =SUMIF(A:A,"<>x",B:B) (the <> means not equal to in Excel).