I will pose the issue with an example. Attached is a print screen of an excel excerpt.
I would like to sum the numbers in column B that matches 2 conditions (green rows in excel). First one: column F equal to "closed". Second one: column C equal to those numbers which in turn matches the following condition: column F equal to "Partial Sold".
I try with the following matrix formula, but I only got the sum that matches these conditions: column F equal "closed" and column C equal "1".
=SUMPRODUCT($D$66:$D$86,IF($F$66:$F$86="Closed",1,0),IF($C$66:$C$86=INDEX($C$66:$F$86,SMALL(IF($F$66:$F$86="Partial Sold",$C$66:$C$86),ROW(1:20)),1),1,0))
Excel Data: This is a print screen
You can produce this with an array¹ formula based on SUM and INDEX with a second nested INDEX delivering the numbers from column C that match Partial Sold. Due to the array formula's cyclic calculation, you have to flip the nested conditional array with the TRANSPOSE function in order that it does not process in-line with the other factors.
The array¹ formula in H4 is,
=SUM(INDEX(D3:D23*(F3:F23="Closed")*(C3:C23=TRANSPOSE(INDEX(C3:C23*(F3:F23="Partial Sold"), , ))), , ))
¹ Array formulas need to be finalized with Ctrl+Shift+Enter↵. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula. Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum. See Guidelines and examples of array formulas for more information.
Related
I need a count if function that counts me the cells that meet a certain criteria. This should be done with countifs. The formula is the following:
=COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:Q;">=1")This formula returns me an value type error.
This formula works well until I introduce the last condition orders!K:Q;">=1"
I would like a formula that counts if the word Ecolab is present in the cell; if the date is after or equal 01/01/2019; if the column U has more or equal than the number 36 and if there is at least a "1" in the cells in the row from column K to column Q. I could do this by easily replicating the countifs several times, (i.e =COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:K;">=1")+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!L:L;">=1")+...........+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!Q:Q;">=1")
But I would rather not include such a long formula as it would create confusion for the ultimate user of the excel sheet
Per my comment above, you could use SUMPRODUCT (avoid using whole columns for that) or an array with OFFSET like this:
=SUM(COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";OFFSET(Orders!J:J;0;{1;2;3;4;5;6;7});">=1"))
If the count for K:Q should be 1 when there may be more than one cell greater or equal to 1 in a single row then you need to apply OR criteria in a SUMPRODUCT.
SUMPRODUCT formulas should not use full column references; there is too much wasted calculation. The following is for rows 2:99; adjust for your own use.
=SUMPRODUCT(--ISNUMBER(SEARCH("ecolab", Orders!D2:D99)),
--(Orders!B2:B99>=DATE(2019, 1, 1)),
--(Orders!U2:U99>=36),
SIGN((Orders!K2:K99>=1)+(Orders!L2:L99>=1)+(Orders!M2:M99>=1)+(Orders!N2:N99>=1)+(Orders!O2:O99>=1)+(Orders!P2:P99>=1)+(Orders!Q2:Q99>=1)))
My spreadsheet has a-ag columns and 100+ rows with the final row being the sum of each column.
trying to do an average if column i has text in it, than add the dollar amount is same row column n,p,q,w than divide total by number of entries in column I row 100.
In english - if column I has text in it add the number is the same row columns n,p,q,w - my question is how to add only specific cells since other cells in the same row will have numbers also
Add a condition to an AVERAGE function by deconstructing it into a SUM divided by COUNTA array¹ formula.
In I12 as an array¹ formula,
=SUM(IF(ISNUMBER(I2:I11), I2:I11, N2:N11+P2:P11+Q2:Q11+W2:W11))/COUNTA(I2:I11)
¹ Array formulas need to be finalized with Ctrl+Shift+Enter↵. If entered correctly, Excel with wrap the formula in braces (e.g. { and }). You do not type the braces in yourself. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula. Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum. See Guidelines and examples of array formulas for more information.
So I have three columns I'm working with.
The first is a list of category IDs.
The second and third are category ID matched with unique user IDs.
I'm trying to say if the value in Column A matches the value in Column B, then return the value of every instance in Column C. VLOOKUP only returns the first value where there's a match, and I'm trying to return all values where there's a match.Thanks for any help!
Try this array formula in Cell D5 and drag to the right and down:
={INDEX($C:$C, SMALL(IF($A$1=$B:$B, ROW($B:$B)-MIN(ROW($B:$B))+1, ""), COLUMN(A1)))}
It will give all matches for the value in Cell A1 in a horizontal list.
Array formulas need to be finalized with Ctrl+Shift+Enter↵. If entered correctly, Excel with wrap the formula in braces (e.g. { and }). You do not type the braces in yourself. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula. Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum. See Guidelines and examples of array formulas for more information.
iam trying to create a COLUMN using array from another sheet of same workbook that omit cell with empty value like shown in column C which is I required
column A Column B Column C
A 15 A
B 10 B
C BLANK D
D 7 F
E BLANK
F 11
I tried this code for got error #NUM
=IFERROR(INDEX('DATE WISE CONSUMPTION'!B$30:B$87,SMALL(IF('DATE WISE CONSUMPTION'!G$30:G$87<>"",ROW('DATE WISE CONSUMPTION'!B$30:B$87)-ROW('DATE WISE CONSUMPTION'!B$30)+1),ROWS(D$30:D31))),"")
A 'list-unique-with-conditions' array formula requires a single cell above the first cell with the formula in order to avoid circular references.
In an unused cell to the right as an array formula¹,
=IFERROR(INDEX('DATE WISE CONSUMPTION'!B$30:B$87, MATCH(0, IF(LEN('DATE WISE CONSUMPTION'!G$30:G$87), COUNTIF('DATE WISE CONSUMPTION'!J$29:J29, 'DATE WISE CONSUMPTION'!B$30:B$87&""), 1), 0)), "")
Fill down as necessary.
Your formula would have worked as an array formula finalized with CSE and this slight modification,
=IFERROR(INDEX('DATE WISE CONSUMPTION'!B$30:B$87,SMALL(IF('DATE WISE CONSUMPTION'!G$30:G$87<>"",ROW('DATE WISE CONSUMPTION'!B$30:B$87)-ROW('DATE WISE CONSUMPTION'!B$30)+1),ROW(1:1))),"")
You were starting off with ROWS(D$30:D31) which resolves to 2 not 1 so the SMALL function was returning the second match to start off with, not the first.
¹ Array formulas need to be finalized with Ctrl+Shift+Enter↵. If entered correctly, Excel with wrap the formula in braces (e.g. { and }). You do not type the braces in yourself. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula. Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum. See Guidelines and examples of array formulas for more information.
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.