Is it possible to have a defined name that applies multiple cells via relative reference? - excel-2010

I have a cell with numerous relative references pointing back to it that span multiple sheets; is it possible to define a name for that original cell and have it apply to all of the other linked cells dynamically? The defined name will need to be changed often. I need to format all of the aforementioned cells dynamically so I was hoping I could use the name to refer to all of them in a formula. Using VBA isn't an option in my situation.

A defined name can refer to, for example:
=OFFSET(Sheet1!C1,,-2)+OFFSET(Sheet2!C1,,-2)+OFFSET(Sheet3!C1,,-2)
Placed in C1 of Sheet4 it should sum whatever is in A1 across Sheets1 - 3 both inclusive and A2 across Sheets1 - 3 both inclusive if dragged down one cell, and so forth.

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))

A way to refer to the "Current cell" for a dynamic Conditional Formatting in Google Spreadsheets

To be more specific, I want the Conditional Formatting to check the content of the cell that is currently being formatted and be dynamic as I copy-paste the Conditional Formatting into another cell, without having to manually fiddle with the formula again.
So what I'm doing is this (using an example):
I have a list of foods categorized by type (Fruits, vegetables, etc...) and every week the list changes, so its not possible to add "hard values" to formulas, it has to be a cell reference under the category.
Which means that under the category "fruits" for example, in week 1 i can have: banana, apple and peach but totally different fruits another week.
Anyways, I also want to create a calendar with the days in the week, where I put 4 drop-down menus which correspond to the 4 types of food. The drop down menus update as I update the initial list of avaiable foods.
Now down to the real issue.
I want that the cell used for the drop down menu to take an specific color when the content of that cell contains a food inside a given category.
For example, I select Apple, it checks for the apple and applies the apple color to the cell.
I acheived this with this
=COUNTIF(A4:A6, INDIRECT("RC","FALSE"))
I found someone online using the INDIRECT("RC","FALSE") value to "reference" the current cell but its not working for me...
A4:A6 is the range of fruits and it will give the red color to the apple because i defined it in Conditionnal formatting.
Now when I copy the conditional formatting is not working for the other apples and I want to make it work for others, just by checking if the current cell contains a value in a range of cells, without manually changing the current cell for every cell.
https://docs.google.com/spreadsheets/d/15trOcNzucTJDDwuseQTsvjhioIGN9W4NEjhztmMZ1so/edit#gid=0
This is my google spreadsheet, please help ! I'm not sure if I can understand better. This is for a much bigger project and really need the help.
Current cell for conditional formatting is left top most cell in Apply to range range.
In your case it is D11. So you should use following formula:
=COUNTIF($A$4:$A$6, D11)

How do I select a specific custom view in a google sheet using code

I have a Google sheet with a column that is used to discriminate across various centers. Each row identifies the appropriate one by its email address.
I am creating as many subviews as there are email addresses and would like to:
Enumerate them
Switch to each one of those sub-views
Do you know if it's possible to do and, if so, how? My google-fu seems lacking.
It is possible, but it depend of what you expect as output, does the output need to be editable or does it only need to be viewable. In the hypothesis of the second option you could use a formula "filter" instead of the "filtered views" the formula filter can be based on on specific cell where you put a drop down of all your options. eg here

Is it possible to refer to a cell by name or label?

If I put some data in a given cell, can I refer to that cell by an arbitrary name or label? For example, if I put the value '0.454' in cell B2, can I assign it a name like 'pounds_per_kg'. I'd like to be able to use 'pounds_per_kg' for calculations performed on other cells, rather than '$B$2' or similar.
You can create a named range by selecting Data > Named ranges from the menu. You can create a one-cell named range and use the range name in your calculations without any problems.
The solution is described in detail here.
i hope this will help you go to your Sheet and in menu section go to Format -> Conditinal Formating here you can give validation what you want?

Set the content of a cell to a function?

I have a spreadsheet in which I want to be able to expand the number of columns using a function rather than using auto-fill because the new cells are getting filled with content based on complex formulas and depending on a lot of things.
In one of these cells I want the content to be something like =SUM(A1:A8)
But if I just do cell.setValue("=SUM(A1:A8)") I get "error: Unknown range name A1", unless I afterwards edit the cell content and press enter, without really having changed its content.
Is there any way of fixing this?
I don't want the calculation to be in the expand-columns-function because I do want the cell-calculation to be updated when one of the referenced cells change.
Is there a way of doing it besides having an onEdit-function listening to changes in the referenced cells and updating the calculations?
Thanks
To set a formula on a cell you should use cell.setFormula not setValue.
I'm not sure I understood you "expand" issue completely, but I think an opened range sum function may suit you better than apps-script. e.g.
=SUM(A:A) or =SUM(A2:A)

Resources