I have an array of cells (C2:D43) in which I want to count the number of times a particular string ("filler") occurs. However, I only want to consider the even rows in my array (so basically, the array is C2:D2;C4:D4, etc.). How can I do this? I'm working with Excel 2007.
This SUMPRODUCT formula will do it:
=SUMPRODUCT((C2:D43="filler")*(MOD(ROW(C2:D43),2)=0))
Try using MOD(ROW(),2)=0 to split up your cells so that your array has two sets: even and odd cells. Then find a way to tell Excel to choose only the values that are the opposite value of the one evaluated at the first row of the array. I'll see if I can find a way to formalize this.
Related
I'm trying to figure out how to use array formulas in Excel 365. Here's a very simple situation I'm starting with. I have an array of values, and I want to get the sum of the values in each row. In reality, I have 2000 rows, and 600 columns, but to simplify let's say I just have the following:
I want to put the sums in the 3rd column (just 6, 60, 600) using an array formula. I know I can just enter a simple formula for one row and copy it down, but I'm interested in seeing how this is done with an array formula so I can just enter a single formula. What I want to do will get more complicated after that, but I want to start with this.
(I'm an experienced Excel user, but I haven't worked much with array formulas in Excel 365.)
Use BYROW/LAMBDA:
=BYROW(C2:E4,LAMBDA(a,SUM(a)))
Another option is MMULT
=MMULT(C2:E4,SEQUENCE(COLUMNS(C2:E4),,1,0))
I am wondering if it is possible - using an Excel formula (no vba) - to loop through a list with values and check if those values are in another list. The idea is to use this to come up with a sum pulling data from the first list while the second list sets the conditions. Please see below picture. I was thinking that this might work with sumproduct including an if-statement. Any ideas?
This should work (F1):
=SUM(SUMIF(Table1[Item],Table2[Included],Table1[Amount]))
but you may need to array-enter it or use SUMPRODUCT instead of SUM in pre-365 versions of Excel.
If you wanted to match ? literally rather than as a wild card standing for any single character you would need F2:
=SUM(SUMIF(Table1[Item],SUBSTITUTE(Table2[Included],"?","~?"),Table1[Amount]))
and similarly for *.
A truncated version of my data is in the form shown in the screenshot below: three columns of 5 unique names. The names appear in any order and in any position but never repeat in a single row.
My goal is to create an array that contains the number of times Adam appears in each row. I can fill down the formula=countif(A2:C2,$I$2) in a new column, or if I write the array manually for each row, it looks like:
={countif(A2:C2,$I$2);countif(A3:C3,$I$2);countif(A4:C4,$I$2);countif(A5:C5,$I$2);countif(A6:C6,$I$2)}
Where cell I2 contains "Adam". Of course, this is not feasible for large data sets.
I know that arrays are effectively cells turned into ranges, but my main issue is that the cell I'm trying to transform already references a range, and I don't know how to tell the software to apply the countif down each row (i.e. I intuitively would like to do something like countif((A2:C2):(A99:C99),"Adam") but understand that's not how spreadsheets work).
My goal is ultimately to perform some operations on the corresponding array but I think I'm comfortable enough with that once I can get the array formula I'm looking for.
try:
=ARRAYFORMULA(IF(A2:A="",,MMULT(IF(A2:C="Adam", 1, 0), {1;1;1})))
I've got a bigger table with one column that I want to focus on, containing designation and a number. I want to simply sum the numbers that meet the criteria based on a designation.
For the simplification, I made an exercising sheet (on the pic) where I split second column into two - one string and one numeric. Since my file is quite large with many columns that would need this it would be inconvenient.
In the left column it's easy to solve the problem, it could be even easier with simple SUMIF function, but an array SUM(IF... function is, at least I think, only viable option here.
So I solved the first table with array function, but what confuses me is how to modulate the TRUE statement. Simple replacement of C:C
with
VALUE(MID(F:F;4;4))
which would format my cells to get the numbers from string does not work that way - returns zero in E12 field. F12 is just application of string to number for last cell, F10.
THIS formula does not work, even adapting to different versions of the tool.
I could use VB but if possible anyhow I would like to avoid it since parts will be shared on mobile phones.
Any ideas? Thanks a lot!
Left table was split, right original format
The array formula which you used can be replaced by the SumIf formula like below...
=SUMIF(B:B,"B",C:C)
Also without the helper column, you can use the Sumproduct formula to achieve the desired output.
But don't refer the whole column in the formula like in the above SumIf formula.
Try this..
=SUMPRODUCT((B1:B10="B")*MID(F1:F10,FIND(",",F1:F10)+1,255)*1)
Change the ranges as per your requirement but remember to make them equal in size.
I have an array formula that looks like this:
{=SUMIF(C11:C23,budgets,F11:F23)}
What I want it to do is sum cells F11:F23 where cells C11:C23 are values within the named range budgets.
Right now budgets has two values: 10361 and 10300 (these are transaction codes). However, the formula seems to only work for the first code 10361 but not for the second one.
I don't want to use SUMIFS because I have multiple worksheets where I would like this array formula to work, and the codes may change so changing them in one place (the named range budgets) will make things easier.
Any ideas? I don't know VBA, so was hoping for a formula solution.
Use SUMPRODUCT with COUNTIF():
=SUMPRODUCT((COUNTIF(budgets,$C$11:$C$23)>0)*$F$11:$F$23)
Or you can use this array formula:
=SUM(SUMIF(C11:C23,budgets,F11:F23))
Being an array it needs to be entered with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done properly Excel will put {} around the formula.