Looking for Google Sheet Array Formula - google-sheets

Hello I'm trying to create a Array Formula for the following B and C columns but getting error,
but without Array Formula the formula works by dragging the formula to all the cells. So I need a Array Formula so I can restrict a formula for specific range, So when I add a new row anywhere in d middle the that row should be working without any formula.
https://docs.google.com/spreadsheets/d/1kc58OkoA3SysApgALJnecnIoK2uyPV6FlhyVRTUXXcI/edit?usp=sharing
So in the above link where there is a list of items in Sheet2 A:
and I importing the list to Sheet1 A: with Array Formula.
Now in D column dropdown list whenever we select an item it keeps removing the used items from C column.
So how to make work while adding Array Formula for B and C Column.

I suggest a complete chage of strategy ... in B1 Sheet2
=arrayformula(countif(Sheet1!D:D,A1:A))
then in C1 Sheet1 (nothing in B1 Sheet1)
=iferror(query(Sheet2!A:B,"select A where A is not null and B=0 "))
the red corner is a good indication that the item is reserved. https://docs.google.com/spreadsheets/d/1m_SACJtoN2k-c1p4C-eflh3pKLmv6YqP8BM2i0jDUhw/edit?usp=sharing

Related

Lookup multiple values from one cell

Trying to obtain desired output shown in E:G from a data show in A:C. I can write a formula
JOIN(", ", FILTER($B$2:$B,$C$2:$C=E2,$A$2:$A=F2))
If there would be a single value in F2 I could get comma-separated output items from column B. But I need to do that for more than one value in F2 cell and get the output shown in column G. How to write a formula that can generate column G as desired?
Any help is welcome.
If you're happy with formula dragging down each cell, as per your example in cell F2, then G2 could be:
=join(",",unique(filter({$A:$A&"("&$B:$B&")"},$C:$C=$E2)))
There are more complex formula to do the calcs with an arrayformula.
Within the filter, there are {} brackets that are used to build an array of data. The array consists of Col A then ( then Col B then ).
It then works the same way as per your example in cell F2. The filter finds each row of the array where Col C matches the value in Col E. Unique and join get the results the same way.
When you drag down the formula, textjoin might be more helpful in ignoring empty cells than join.
Use this in cell F2:
=textjoin(",",true,filter(A:A,C:C=E2))
this in cell G2:
=textjoin(",",true,unique(filter(if($A:$A<>"",{$A:$A&"("&$B:$B&")"},),$C:$C=$E2)))
Using arrays in Google Sheets
https://support.google.com/docs/answer/6208276/using-arrays-in-google-sheets?hl=en-GB

Arrayformula for Google Sheets doesn't work as before

Some week ago, an array formula I use in Google Sheets stopped working correctly:
=arrayformula(if(row(A:A)=1,"Convert Type",if(len(A:A)=0,iferror(1/0),iferror(vlookup(C:C,'Sheet2'!$A$2:$B,2,FALSE),"Error"))))
This formula is in Sheet1 column B1, in the frozen first row. What it is supposed to do is to take the values from Sheet1 column C, compare the values from Sheet2 column A, and insert the values in Sheet1 column B for those corresponding in Sheet2 column B (from Type1 to Type2). If there is a mismatch between the possibilities in Sheet2 column A and Sheet1 column C, the new value in Sheet1 column B will be 'Error.' The formula stops when there is nothing in Sheet1 column A (Timestamp).
Now, for some reason, all the values in Sheet1 column B are set to 'Error.' Something similar happened before when Google made a back-end update, but this time I can't figure out what I am supposed to change. Any ideas?
Example Sheet
Edit: made the text clearer and added a link with example.
Just adding a extra space in your formula updates the formula to correct values and I'm unable to find the source of the error.
Regardless, the formula was unnecessarily complicated and I simplified it a bit to it's core bone version. Try this instead:
=ARRAYFORMULA({"Convert Type";VLOOKUP(C2:INDEX(C:C,COUNTA(C:C)),Sheet2!A:B,2,0)})

Using ARRAYFORMULA with OFFSET where the array should be the offset_rows not the cell_reference

I have a table that connects serial numbers to items (e.g. 1 - Orange, 2 - Apple, 3 - Banana)
In col A I have a list of serial numbers and in col B I want each to fetch the relevant item.
Example,
col A: 2,1,3,1
col B should show: Apple,Orange,Banana,Orange
col A updates automatically so I need the function in B to auto update as well. I'm trying to use the ARRAYFORMULA function where the cell range is fixed (the table linking # to items) and where the array should run on the offset_rows
The formula should look something like:
=arrayformula('Table',A1:A,0)
but it doesn't work. It seems as if the array can only be on the cell range (the Table) and not on the offset_rows (A1:a).
Can I use the arrayformula that way? If not, are there any alternatives?
VLOOKUP should work instead. Try this formula in cell B1:
=ArrayFormula(IFERROR(VLOOKUP(A:A,Table,2,0)))
I set up an example sheet here:
https://docs.google.com/spreadsheets/d/1r8jqUo5tY0s4K3Bhxxstn2__sdtMtiaeMO29ik9XUuw/edit?usp=sharing

Filter one sheet, A, with another, B, to get a new sheet, C, with rows that don't exist in B

I'm trying to get rid of bad data in my inventory list.
Sheet A is a sheet that is a list of all my products.
Sheet B is a sheet, generated from another piece of software, that lists all of my products that have been sold
I need to generate a third sheet, Sheet C, that lists all the unsold products. So, the number of rows between Sheet B and Sheet C should add up to the total number of rows on Sheet A.
How do I cross-reference/filter Sheet A with B to achieve C?
The following formula returns the list of entries from column A of Sheet1 that are not present in column A of Sheet2:
=filter(Sheet1!A2:A, isna(match(Sheet1!A2:A, Sheet2!A2:A, 0)))
Explanation: match returns error code #N/A for those entries in Sheet1!A2:A that are not found in Sheet2!A2:A. The isna function converts those to True boolean values. Finally, filter returns those rows for which the second argument evaluates to True.
The filter can return more than one column: it can be, for example,
=filter(Sheet1!A2:Z, isna(match(Sheet1!A2:A, Sheet2!A2:A, 0)))
But match requires a one-dimensional range, so you need a column (here assumed to be A) which can be used as an identifier of a row.

Take values from column and put into a row

In google docs I am tryignt to take the values from a column in one sheet and use them as column headings in another sheet without duplicates.
Thus if sheet1 has
a
a
b
f
g
g
Sheet 2 should have it as
a b f g
In Excel I would just use VBA code, how do I do it in a google sheets?
I know the command to get it into a column, but not into a row
=unique(sort('Acumen Lead Tracker'!X3:X64,1,true))
Thanks
Try in Cell A1 of the second sheet:
=transpose(unique(Sheet1!A:A))
where Sheet1 is the sheet where the values you want to use as headers are found in col A.

Resources