Define range for sum/sumif with a formula - arrays

I've been going up and down the internet to solve this. I think I am not searching with the correct parameters but I still hope you can help me.
Sample table:
I have some consolidation forms I need to fill with sums. So, in C19 (which is actually on a new tab) I would like to sum all the values C5-C12 which are mapped to the AB100 account for the consolidation, in production for example. The AB100 account is not unique to production, so I first need to define the column in which the specific row(s) have to be used to sum the values. Automating that in a formula is my key issue here.
I could easily solve this by just selecting column E as range for SUMIF but I want the formula in C19 to be able to recognize which column is to be looked at automatically, e.g. by using a "Lookup Key". I have many of those consolidation forms and I don't want to manually change the formulas on each tab.
It seems to me that all tips I found for nested SUM(IF( or SUM(INDEX( - even as array formulas - have the result value on the intersection of matched row and column. What I have on that intersection is a range of identical account numbers which need to be matched back to their respective $ values in C5-C12.
Any idea how I can do this with a formula?

Use INDEX/MATCH
=SUMIF(INDEX(D5:F12,0,MATCH(C16,D4:F4,0)),B19,C5:C12)

Using an index formula to select the column required in the SUMIFS
Hope this helps!

Related

Filter by two conditions + Array Formula alternative in google sheets

I am well aware that FILTER doesn't work with Array Formula. On all of the posts I've seen, people are substituting it by Array Formula + Vlookup. My problem is that I use FILTER on more than one condition.
Example: FILTER(Deliveries!A:A, Deliveries!C:C=A2,Deliveries!B:B=B2)) (This is in a different sheet, where I use filters in both Columns B and C).
This sheet is the repository of a form, and when the form adds rows the formulas do not get copied down to the added rows, hence my effort to turn this into an Array Formula or maybe a query. I'd be equally satisfied with another solution (i.e. something that forced formulas to always follow the addition of new rows).
Thank you very much for your time!
try in row 1:
={"header"; ARRAYFORMULA(IFNA(VLOOKUP(A2:A&B2:B,
{Deliveries!C:C&Deliveries!B:B, Deliveries!A:A}, 2, 0)))}

How to use index match (array formula) to return corresponding values from a drop down list?

Excel Screenshot
Excel Screenshot with Formulas
I have attached photos to show an idea of what I am trying to do. Basically, I have a very large list of features that are shared between certain groups. I want to use a drop down list of the features, and then have a formula that will output the group that has the lowest cost of that feature along with the cost of that feature within the group.
(Also you will see that I purposefully ignore zero values. I do this because not every group has a certain feature and those cells default to zero).
I figured out how to get the cost of the feature to output, but I'm having trouble getting to output the group name. I am assuming there will be an array formula to do this, but I am just starting to learn those and I'm having trouble with this one.
Well you could always use the same approach you used to pull in the value, by pulling in the index of the column heading that matches the computed min, and using an offset function to match on the right row:
=+INDEX($B$1:$D$1,MATCH($B$10,OFFSET($B$1:$D$1,MATCH($A$7,$A$2:$A$4,0),0),0))
The thing is, I'm not sure how you would want to handle ties, if 2 vendors had the same price, this would match the first one in the list.

SUM with IF conditions for cells containing both strings and numbers

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.

Index/Match with three criteria

I have searched and searched and searched and searched, I can only find solutions for index/match with two criteria.
does anyone have a solution for index/match with three criteria?
as a sample of my actual data, i would like to index/match the year, type and name to find the data in the month column
You can match an unlimited number of criteria by using SUMPRODUCT() to find the proper row:
=INDEX(D2:D9,SUMPRODUCT((A2:A9=2015)*(B2:B9="Revenue")*(C2:C9="Name 1")*ROW(2:9))-1)
EDIT#1:
Scott's comment is correct! The advantagesof the SUMPRODUCT() approach is that it is not an array formula and can be expanded to handle many criteria. The disadvantage is that it will only work if there is 1 matching row. The use of SUMPRODUCT() is explained very well here:
xlDynamic Paper
Because your question has numerical data, you can simply use SUMIFS.
SUMIFS provides the sum from a particular range [column D in this case], where any number of other ranges of the same size [the other columns, in this case] each match a particular criteria. For text results, one of the other recommended solutions will be needed.
In addition to being a little cleaner, this has the attribute [could be good or bad depending on your needs] that it will pick up multiple rows of data if multiples exist, and sum them all. If you expect unique rows, that's bad, because it won't warn you there are multiples.
The formula in your case would be as follows [obviously, you should adjust the formulas to reference your ID cells, and pick up the appropriate columns]:
=SUMIFS(D:D,A:A,2015,B:B,"Revenue",C:C,"Name1"))
What this does is:
Sum column D, for each row where: (1) column A is the number 2015; (2) column B is the text "Revenue"; AND (3) column C is the word "Name1".
If assuming your data starts in A1 ("Year") and goes to D15 ("????"), you can use this. You bascically just add your criteria with &, then when doing the Match() regions, connect their respective ranges with & as well.
=Index(D2:D9,Match(A15&B15&C15,A2:A9&B2:B9&C2:C9,0))
and enter with CTRL+SHIFT+ENTER and make the references absolute (i.e. $D$2:$D$9), I just didn't to keep the formula a little easier to read.

Array formula to ouput project names

I am trying to use an array formula to look at column R and if column R says concepting- it will give me the list of project names in columns A that are currently in concepting.
The formula I am using is:
=IFERROR(INDEX('ACTIVE PROJECTS'!$A$1:$A$350,SMALL(IF(('ACTIVE PROJECTS'!$R$1:$R$350="CONCEPTING")),ROW('ACTIVE PROJECTS'!R$1:$R$350))ROW(2:2))),"")
It keeps telling me my formula has an error.
Can anyone help with the formula?
You were pretty close. A misplaced bracket and a missing comma was all that was fouling up the works.
=IFERROR(INDEX('ACTIVE PROJECTS'!$A$1:$A$350,SMALL(IF('ACTIVE PROJECTS'!$R$1:$R$350="CONCEPTING", ROW($1:$350)), ROW(1:1))),"")
I tightened up the formula by using ROW($1:$350) in place of ROW('ACTIVE PROJECTS'!R$1:$R$350). The ROW function doesn't actually care where the row number comes from.
Now, that is not a unique list; just a list of those projects that have a CONCEPTING value in column R. I suppose the nature of the data could make that list unique but the formula does not. A unique list is slightly more involved.

Resources