I have an excel formula that is looking for some courses in an array from a cell. In the picture below the column A2 is populated automatically from Wix with an array of courses that can contain 1 to 10 courses. And in regard to this array, the A:K columns are populated with 1 if the course exist in the array and 0 if not.
The formula is: =--ISNUMBER(FIND(""""&B2:K2&"""",A2))
The problem is when I fill a row and drag and drop to populate the formula to a great number of rows, the formula is changing. I need to keep B2:K2 the same, and only the A2 should change . If the row is A3, in the formula I should have =--ISNUMBER(FIND(""""&B2:K2&"""",A3)).
How can I automatically do this, because I have a large numbers if rows, and cannot right the formula to all rows?
If you want to keep B2:K2 constant then lock them by $ means absolute position like-
=--ISNUMBER(FIND(""""&$B$2:$K$2&"""",A2))
You can try below formula at once for whole range of data.
=IF(ISERROR(FILTERXML("<t><s>"&SUBSTITUTE(A2:A4,",","</s><s>")&"</s></t>","//s[contains(., '" & $B$1:$K$1 & "')]")),0,1)
Related
I am trying to identify inventory shortages for each store and the type of bread I am supplying.
Example table showing the demand for each type of bread by store.
Row 8 is what I am trying to accomplish with a formula.
Based on the quantity on hand, I can conditionally format to highlight cells red or green based on shortages.
I can't get a formula to count the number of red cells.
I am thinking I need to use sumproduct.
=SUMPRODUCT(--($B9:$B11<C9:C11))
The above works for identifying shortages for Store A (Column C). However, when dragged to column D and E it doesn't remember what the other stores needed.
I can't get the rows to sum without adding ALL rows in the range. I need each row to be individually compared to the qty on hand. I assume an array needs to be used.
This is the formula I mentioned. It uses a standard method with mmult to get the row totals of the matrix, then compares them with the amounts available:
=SUM(--($B9:$B11<MMULT($C9:C11,TRANSPOSE(COLUMN($C9:C11)^0))))
entered in C8 and pulled across. Must be entered as an array formula using CtrlShiftEnter
EDIT
OP has commented that it shouldn't be listed as a shortage if a store doesn't need a particular item, even if the stock of that item has been exhausted.
So there should be an extra condition for it to be registered as a shortage only if the current column has a number >0 in a particular row as well as the row sum being greater than the amount available:
=SUM((C9:C11>0)*($B9:$B11<MMULT($C9:C11,TRANSPOSE(COLUMN($C9:C11)^0))))
If you wanted to select only some of the rows as well it would look like
=SUM(ISNUMBER(MATCH($A9:$A11,{"Wheat","Rye"},0))*(C9:C11>0)*($B9:$B11<MMULT($C9:C11,TRANSPOSE(COLUMN($C9:C11)^0))))
EDIT: FIXED TO WORK FOR CONDITIONAL FORMATTING:
Paste this into the module:
Public Function CellColour(addr)
CellColour = Range(addr).DisplayFormat.Interior.Color
End Function
Function FINDRED(rng As Range)
FINDRED = 0
Dim cell As Range
For Each cell In rng
If (cell.Parent.Evaluate("CellColour(""" & cell.Address & """)") = RGB(255, 0, 0)) Then
FINDRED = FINDRED + 1
End If
Next cell
End Function
You can then use this like a normal excel formula:
I have a table (Table 1) with range D1:F20. In this table I have a series of data. Several rows in Table 1 have #N/A in cells of column D.
D1:F1 are headers.
I would like to create another table (Table 2) that collects all data in Table 1 except those rows that have #N/A. As I am thinking about it, I presume this will have to be an array formula that will loop through the rows in Table 1 and post to table 2 those without #N/A.
I have built the following formula:
{=INDEX($D$1:$F$20,MATCH(FALSE,ISERROR(D2),0))}
I have made it to be an array formula but it's not working. At the moment, it just returns Table 1 as it is, i.e., with all rows including those with #N/A.
How can I achieve the desired result?
Use this formula and copy down to get just the non-error cells from your column D:
=IFERROR(INDEX(D:D,SMALL(INDEX(NOT(ISERROR($D$2:$D$11))*ROW($D$2:$D$11),),SUMPRODUCT(--ISERROR($D$2:$D$11))+ROW(H1))),"")
Then you can do a VLOOKUP formula to get the contents from your columns D and E (assuming the contents of column D are unique).
If the contents of column D are not unique, copy this formula over to get the contents of E and F.
To increse formula performance, I recommend putting the Sumproduct portion in its own cell (this cell can be hidden, or even be put on a different worksheet and hide that worksheet), so that it is only calculated once and then referenced, instead of having each formula calculate it all over again. This also lets you avoid the Iferror so that the formula doesn't have to be calculated when it runs out of valid values. We'll say the Sumproduct formula gets put in cell Z1 as just this:
=SUMPRODUCT(--ISERROR($D$2:$D$11))
And then the main formula becomes this:
=IF(ROW(A1)>$Z$1,"",INDEX(D:D,SMALL(INDEX(NOT(ISERROR($D$2:$D$11))*ROW($D$2:$D$11),),$Z$1+ROW(A1))))
In Google Sheets, running an array to transpose raw data into a readable format. The array forumula runs off of a row of data and am using the array to transpose the data into multiple rows. The issue is that for every additional row of raw data, I create five new rows of transposed data so the array formula breaks. Trying to make the array formula flex to added rows of data - any thought would be appreciated!
https://docs.google.com/spreadsheets/d/16GOsH-EUDm2IeRgUgEQ8LBEltQASfJ8hR6GXh-pqNcM/edit?usp=sharing
Rather than use an array formula, you can use an indirect formula and modulo arithmetic and integer division to do this. In k2 put the formula =indirect("A"&(3+FLOOR((row()-2)/5))) which will get the date from column A row 3 until you get down to row 7, when it starts taking from row 4. This formula can be dragged down and will jump rows every 5 as desired.
Similarly for L2 place in =indirect("B"&(3+FLOOR((row()-2)/5))) which can also be dragged down (copied) the column.
For column m we need to cycle through c2,d2,e2,f2, and g2, so we need modulo (clock) arithmentic. So in m2 place the formula =indirect(char(CODE("C")+(mod(ROW()-2,5)))&"2"). Finally for quantity we need to do both the column cycling and the incrementing rows every 5, so the formula for n2 is =indirect(char(CODE("C")+(mod(ROW()-2,5)))&(3+FLOOR((row()-2)/5))). That too can get copied on down. That should do it. There could definitely be more elegant ways.
I think not more elegant, but preserving the array formula would be =3+floor((row()-2)/5) in j2 and drag on down, and then adapt the array formula to: ={INDIRECT("A" & J2),INDIRECT("B"&J2),$C$2,INDIRECT("C"&J2);INDIRECT("A" & J2),INDIRECT("B"&J2),$D$2,INDIRECT("D"&J2);INDIRECT("A" & J2),INDIRECT("B"&J2),$E$2,INDIRECT("E"&J2);INDIRECT("A" & J2),INDIRECT("B"&J2),$F$2,INDIRECT("F"&J2);INDIRECT("A" & J2),INDIRECT("B"&J2),$G$2,INDIRECT("G"&J2)} which can be copied to 5 rows below it where the J2's become J7's and you are processing the next desired row.
I have approx. 100 rows by 60 columns with numbers which I'd need to be arranged in (same) bins categories. (12 bins)
In a new sheet, I used the frequency formula to look at the first row and return in an array in a column the distribution in bins. It worked for the first row of the source data but now I'd like that when I drag the formula to the next column, the data array in the frequency formula to move to the next row of the data source and return the distribution by bins.
Is it possible, can you please help with this one? Or is there any other way I can do such a bin arrangement? Need frequencies for A, B,C etc..and would like to drag the formula to the right, if that is possible.
partial data-distributed horizontally
Use the following formula for Column U:
=FREQUENCY(INDIRECT(ADDRESS(COLUMN()-19,3) & ":" & ADDRESS(COLUMN()-19,18)),$T$3:$T$17)
and drag/copy across as required. For details on INDIRECT function see this.
Note: INDIRECT is a volatile function and hence is recalculated every time anything changes in the worksheet.
See image for results based on data provided by you.
I want combine the row and column names where they intersect. I tried to use concatenate with reference cells, but filling down and across requires changing the references of multiple cells. I am dealing with a large grid (2000 rows x 200 columns). Is there a formula that will help me fill down and across?
Before & Desired Results Picture
The formula you need to use is
=CONCATENATE($A2, " > ", B$1)
$ sign 'locks' the cell, whereas cell without it is copied across.