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.
Related
In Excel 2016, I have a "Brands" column, each of its rows containing a string. The set of possible string values is limited, and they may appear more than once.
There is related data in another column, "Models". Each model value is always different.
How can I get Excel to generate a column for each existing brand and populate it with the corresponding Models in an automatic way?
My problem is that I can't do it manually because for each analysis, the amount of Brands is different and I don't know it beforehand.
This would be the input:
And this is the expected output:
Any ideas?
Thank you in advance!
Try using an array formula. First, put the distinct brand values on row 1, starting in column D. You can use column C if you want, but I like to have an empty column between the data and the desired results.
D1 = Apple, E1 = Nokia, F1 = Samsung, G1 = Xiaomi
Then, just below Apple in cell D2, paste this formula:
=IFERROR(INDEX($B$2:$B$9999, SMALL(IF(D$1=$A$2:$A$9999, ROW($A$2:$A$9999)-ROW($A$2)+1), ROW(1:1))),"")
If you have more than 9999 rows, then adjust as needed in the formula.
With the cursor still in the formula, make it an array by simultaneously pressing CTRL-SHIFT-ENTER.
Copy the formula across to cells E2, F2 and G2. You may need to repeat the array trick (CTRL-SHIFT-ENTER) for each of those again if things look wrong. So, your excel will look like this:
Now, drag the formulas down as far as you need. The iferror part of the formula will ensure that cells look clean if no more models are found.
---EDIT AFTER RECENT COMMENT---
I cannot determine how to automatically pick distinct values from column A and automatically convert them to a row. It's easy to keep it in a column, but the transpose to row is troubling.
At any rate, here's the ugly update. Cell D1 would simply state "Brands". In cell D2, make this an array formula (CTRL-SHIFT-ENTER).
=IFERROR(INDEX($A$2:$A$9, MATCH(0, COUNTIF($D$1:D1, $A$2:$A$9), 0)), "")
So, row 2 will be your brands. Drag the formula across, repeat the array trick.
Now, in cell E1, type formula =D2. Drag across.
Place the formula suggestion from the original answer, starting in row 3. End result looks like this below. It should be "automated" now, but it's not appealing. Minor edits will help (making row 1 nearly invisible, for example).
I am using INDEX(MATCH) to look up a value in one column using criteria from two different cells in another sheet. Here is the formula I am trying to use:
=INDEX(Sheet1!P:P,MATCH(1,(Sheet1!A:A=Sheet2!C$1)*(Sheet1!B:B=Sheet2!$B2),0))
Sheet1 is the array and column P contains the values I am wanting the formula to return. Column A in Sheet1 contains the values for the first criteria and Column B in Sheet1 contains the values for the second criteria. The criteria are represented in C1 and B2 of Sheet2. This will change as the cell is copied. Can anyone see any errors in this formula? It is returning a "value is not available for the formula or function."
This will have to be entered as an array formula¹ so the full column references should be cut down to a minimum size or you will experience unnecessary calculation lag as hundreds of thousands of blank cells are processed.
With text in column A,
=index(Sheet1!$P$1:index(Sheet1!$P:$P, match("zzz", Sheet1!$A:$A)),
match(1, (Sheet1!$A$1:index(Sheet1!$A:$A, match("zzz", Sheet1!$A:$A))=Sheet2!C$1)*
(Sheet1!$B$1:index(Sheet1!$B:$B, match("zzz", Sheet1!$A:$A))=Sheet2!$B2), 0))
With numbers or dates in column A,
=index(Sheet1!$P$1:index(Sheet1!$P:$P, match(1e99, Sheet1!$A:$A)),
match(1, (Sheet1!$A$1:index(Sheet1!$A:$A, match(1e99, Sheet1!$A:$A))=Sheet2!C$1)*
(Sheet1!$B$1:index(Sheet1!$B:$B, match(1e99, Sheet1!$A:$A))=Sheet2!$B2), 0))
You did not have absolute reference anchors (e.g. $ ) in the original Sheet1 range references but the way you had them set up for the criteria from Sheet2 led me to believe that you required them for both row and column.
If you have column header labels in row 1, change A1, B1 and P1 to A2, B2 and P2.
¹ 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.
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.
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.