I just learned about using wildcards in Excel functions like COUNTIF(), and I wondered whether there is any circumstance under which the following two formulas would give different results:
=COUNTIF(B1:B10,"*")
{=SUM(ISTEXT(B1:B10)*1)}
The objective is to count the number of text (non-numeric) values in the range.
In the following example, B3 is the formulta =MID("abc",3,1) and B9 is the formula =SUM(1,2), so I know it works for formulas that return text or numeric values. But is there any odd type of cell content that would cause COUNTIF() and the SUM array formula to give different counts?
Related
Following this 2019 question and it's great answer I have learnt that to sum all cells that has formula, I should use:
=SUMPRODUCT((ISFORMULA(B5:M5)=TRUE)*B5:M5)
And to sum the cells that doesn't have formula, I should consider:
=SUMPRODUCT((ISFORMULA(B5:M5)=FALSE)*B5:M5)
But, can I use the above (or something else) in the way similar to using SUMIF with three arguments (summing values from other column than the one that is checked for conditions)?
Meaning that I need to solve following problem:
Sum all values in the range I2:I21, but only for those cells for which the corresponding cells in the range B2:B21 are not a formula / enumerable value.
I wonder if I'm not excepting too much and whether such a problem can be solved with just a formula, without using a macro.
The other answer posted under mentioned question has gave me an insight to solve this problem.
Using following formula:
=SUMPRODUCT((I2:I21)*(NOT(ISFORMULA(B2:B21))))
gives me exactly the values that I want. That is: sum of all values in I2:I21 range for which corresponding cell in B2:B21 range is a "hardcoded" value and not a result of an evaluable formula.
Formula help required to display the desired result with multiple criteria in cells.
In the below table D2 cell the formula is added to to show the result eg: F2 cell. The criteria of finding the specific text in A2 cell is the blocker in the function to give the desired result
=IF(AND(ISNUMBER(SEARCH("FF",A2)),B2=1,C2="MC"),"Fotp"),IF(AND(ISNUMBER(SEARCH("2D",A2)),B2=1,C2="MC"),"2D"),IF(AND(ISNUMBER(SEARCH("MF",A2)),B2=5,C2="MC"),"Modfix"),IF(AND(ISNUMBER(SEARCH("SE",A2)),B2=0.7,C2="SE"),"SoEv"),IF(AND(ISNUMBER(SEARCH("M Cat",A2)),B2=19,C2="MC"),"Mcat"),IF(AND(ISNUMBER(SEARCH("M cod",A2)),B2=1.25,C2="MC"),"Ing")
Try
=IF(AND(ISNUMBER(SEARCH("FF",A2)),B2=1,C2="MC"),"Fotp",(IF(AND(ISNUMBER(SEARCH("2D",A2)),B2=1,C2="MC"),"2D",(IF(AND(ISNUMBER(SEARCH("MF",A2)),B2=5,C2="MC"),"Modfix",(IF(AND(ISNUMBER(SEARCH("SE",A2)),B2=0.7,C2="SE"),"SoEv",(IF(AND(ISNUMBER(SEARCH("M Cat",A2)),B2=19,C2="MC"),"Mcat",(IF(AND(ISNUMBER(SEARCH("M cod",A2)),B2=1.25,C2="MC"),"Ing")))))))))))
Your original formula is not nesting the IFs properly.
By the way I think if you can make a look up table with all the criteria and expected result, then there is a quicker way of returning the result without the need to use nested IFs (just imagine if you have 100+ combination of criteria).
Newbie-ish with Excel here. I'm trying to keep things simple for long term ease of use since most at my job don't know much of anything with Excel or anything with VBA.
I'm looking to have a formula count cells containing up to 4 different codes (TRM2-TRM5) out of 32 possible codes. However, the cell these combinations are entered in is not required to be in any specific order.
Such as:
B1 (TRM2, R2, TRM3)
B2 (TRM2, PN1, DC5, TRM4)
B3 (PN1, IPA5c, HW2, TRM5)
B4 (PN1, HW2, R2)
The desired result of the formula is a count of 3
I don't need to count the individual number of times the TRM codes appear. Just the number of cells they appear in a range (such as B1:B99).
I've tried COUNTIFS but quickly discovered I'd have to have a COUNTIFS for each possible combination of the 4 codes.
So far the simplest way is to use multiple instances of conditional formatting that highlights the cells that contain one of the four codes and do a visual count. All the examples I've read don't have multiple values in one cell so I'm not sure how to tackle it.
For those that are curious, the purpose is error reporting for issues missed in an audit.
Thanks for the help!
Given your example, you can do this with a helper column.
Either hard code an array constant with the codes to find, or enter them in separate cells someplace. I did the latter and named that range theCodes.
Use this array formula in the helper column:
C1: =MIN(FIND(theCodes,B1&CONCAT(theCodes)))<LEN(B1)
and fill down as far as needed
This will return TRUE or FALSE depending on whether any of the codes are present in the cell.
Then, a simple COUNTIF will count all the TRUE's
D1: =COUNTIF($C:$C,TRUE)
NOTE: To enter/confirm an array formula, hold down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula seen in the formula bar.
I want to do a T.TEST of the values in rows (2,3,8,9) vs. (4,5,6,7). I tried doing T.TEST((D1:D2,D8:D9),D4:D7,2,2) but Excel didn't like it. Is there a way to skip rows like that?
As a test I tried SUM((D1:D2,D8:D9)) and did get the right result.
SUM will work with non consecutive cell ranges also. But TTEST needs two matrices, either from consecutive cell ranges or from array literals like {1;2;3;4} or {1,2,3,4}.
So you could use INDIRECT in collaboration with N to create a matrice from a non consecutive cell range.
=TTEST(N(INDIRECT({"D2";"D3";"D8";"D9"})),D4:D7,2,2)
Since TTEST needs matrices there, it is in array context already. So this formula needs not be inputted as an array formula using [Ctrl]+[Shift]+[Enter].
Note the "D2", "D3", ... within INDIRECT are text strings and not cell references. So they will not be updated if the formula is copied.
I'm working on a spreadsheet and I need to have a set of cells ignored if they are blank. I tried a regular average formula as well as if statements and nothing seems to be working. The values need to be adjusted so they come to a common value. Here is the formula I am trying to use to calculate the average.
=(AVERAGE(D4,(F4*0.6),(H4*(6/7))))
This formula will calculate the average but is not ignoring cells that do not have a value.
Excel should automatically ignore truly blank cells when using the =Average() formula. However, if you do have some "0" data or space characters, you could use the following to find the average of anything that is numeric:
=SUM(A:A)/COUNT(A:A)
Where A:A is your range.
EDIT: Simplified to use Count which only finds numeric cells.
EDIT 2: Given your specific example, the average function could look as follows:
=IFERROR((D4 + (F4*0.6) + (H4*(6/7)))/COUNTA(D4,F4,H4), 0)