=FILTER arrayformula with - google-sheets

Test sheet
I have an Options sheet that categorizes transactions based on their type. In the Transactions sheet, I add transactions with their corresponding category, and I am trying to create a formula where the corresponding category type is automatically added in the column next to it.
I have been able to create a partially working formula:
=ARRAYFORMULA(FILTER(Options!C:C,Options!B:B=D31))
I want to expand it across all the cells in column E using an ARRAYFORMULA, but I can't seem to figure out how to have the Options!B:B=D with the corresponding cell. Making it =D31 I've been able to figure out, but having one formula at the bottom (at Ref 1) and then the right category type for each corresponding cell, I have not.

use in E2:
=ARRAYFORMULA(IFNA(VLOOKUP(D2:D, Options!B:C, 2, 0)))

Related

Change cell value based on checkbox in Google sheets

I'm using Google sheet to manage my budget (see sample below) where I add each of my expenses as a single entry (yes, sounds like a lot of work). I sometimes split the expense with my roommate but then I have to add the value and divide by 2 everytime.
I was thinking if I could use a checkbox next to the value that will automatically divide the expense number by 2 when I check it. Is this possible?
I'm open to simple suggestions other than the checkbox to automatically update the value. Thank you.
Using simple IF formula you can just check if the checkbox is true, if it is then it will divide the current value on column C by 2. Otherwise it will remain blank.
Formula:
=IF(D1,C1/2,"")
Drag down to other cells.
Result:
Suggestion, Alternate solution:
If you'd like you can make a table with a column for your roommate, instead of editing the actual column so you can see both values. And use this formula:
=if(NOT(D2=""),E2/2,E2)
You have a column for per head contribution/split. If the cell on roommate is blank then it will stay as the total value, if roommate has an additional then it will be added to total and split it by 2.
Or using arrayformula:
=arrayformula(if(NOT(D2:D=""),E2:E/2,E2:E))
Works the same as above you just have to fill the enter the formula in the first cell no need to drag down and it will automatically expand to rows/cells below just make sure that below cells are empty or it will return an error.
Additional - Using same cell
As you've mentioned in the comments. Here's a way to divide the original value without using another cell to store it. (Not recommended)
Formula:
=VALUE/IF(D1,2,1)
example:
=1000/IF(D1,2,1)
Result:
However, I do not recommend this. It is still best to make use of another cell to store the original value before making calculations to it.
Also, using this formula you have to change the value from the formula and not on the cell otherwise you will replace the actual formula.
You can try array approach-
=ArrayFormula(IF(D1:D,C1:C/2,C1:C))

Google sheets: how can I use "sort sheet" when a column uses UNIQUE?

I use UNIQUE in the first column (cell A2) of my sheet to pull in unique item names from another sheet. In the other columns I have various properties for each item.
I want to be able to play around with different sort orders based on the properties, using the menu options "sort sheet A->Z" and "sort sheet Z->A" (i.e. not having to change a cell formula every time I want a different order).
But every time I do this, the sheet gets messed up, because the cell with the UNIQUE formula jumps from A2 to another position in A (leaving all cells above it empty). Is there a way to avoid this?
So far, this is the best advice I could find:
https://alicekeeler.com/2016/07/10/google-sheets-find-unique-entries/
which suggests to use UNIQUE, copy, paste-special, then sort away.
(I'll keep this question open for a while in case anyone has better suggestions.)

Google sheets - is it possible to enter a formula in a cell, using the data from the same cell?

In google sheets, is it possible to enter a formula in a cell, using the data from the same cell?
Not directly. But you can have a duplicate sheet, with the duplicated sheets referencing the other one with the proper formula for any change you want.
For example you want an updated 'view' sheet (B)for some other user that also change some value based on the data you have on your sheet (A) but you dont want them messing with your Sheet (A).
The solution is to create a sheet B that references sheet A , for example by using IMPORTRANGE if you want to just show information, or the a formula that involves referencing data from your sheet A.
The answer is really simple : no. Because of a really simple algorithm :
1 - Target cell formula's parameter and go to step 2
2 - If a targeted cell changed go to step 3 else finish the treatment
3 - Evaluate the formula, display the value into the cell and finish the treatment

Google Spreadsheet Applying functions to unfilled rows

I have a Google Sheet that is filled from a Google Form, and I need to apply functions in some columns of each row that is not been filled (inserted).
When the user fills the form the data goes to the sheet but the functions shifted to the next row by itself, but I want to apply the function in the same row.
You just need to use arrayformula so in N2 you would enter:
=IF(ISNUMBER(J2:J),J2:J+M2:M,)
This causes the formula to run itself down the sheet only once there is a value in the cells your trying to add. This way it doesnt prevent new entries from being added

Formula missing when Adding Rows in Google Sheets

I have made a simple formula, based on cells in the same row, to indicate to the user that they have entered enough information - and it works as needed .
=IF(AND(ISTEXT(B20),ISNUMBER(C20),ISNUMBER(E20),ISTEXT(F20)),"Ok",IF(AND(ISBLANK(B20),ISBLANK(C20),ISBLANK(D20),ISBLANK(E20),ISBLANK(F20)),"","MORE INFO"))
However, when I click the built in "add more rows" button at the bottom of the sheet the formula is not present in the new cell - but any dropdown menu or validation I've used in the cells not containing the formula are present in the respective added cells of the new row. Any Ideas why just the formula is missing ? Thanks.
Thanks to GimelG at Google Docs Forum..........
When you add additional rows, Sheets assumes you want to continue the same dataset and, therefore, applies the existing formatting as well as Data Validation. It does not, however, copy formulas automatically as that would be adding actual new data to your sheet.
You can use an ArrayFormula version of your formula to populate the entire column, which it would continue to do as you'll add more rows of data. Assuming your data starts at row 2 (below the header), try this:
=arrayformula(if(istext(B2:B)*n(C2:C)*n(E2:E)*istext(F2:F),"Ok",if(len(B2:B)+len(C2:C)+len(D2:D)+len(E2:E)+len(F2:F),"MORE INFO",)))

Resources