How to dynamically set tab name in a formula? - google-sheets

I have a summary tab and multiple other tabs which are constructed the same way. I would like in my summary tab to gather information from all other tabs
Today, in the summary tab I have for each line:
first cell: My tab 1 -> name of a tab in the same spreadsheet
second cell: =COUNTIF('My tab 1'!$B7:$B; "OK") -> count of all cells with "OK" text in column B.
I would like to use the tab name defined in the first cell inside the formula of the second cell. Is it possible and, if yes, how?

Try the INDIRECT function, described here: https://support.google.com/docs/answer/3093377?hl=en
=INDIRECT($A$1)
In order to be seen as a reference for the range, INDIRECT needs the entire range reference as a single string, it seems. This gives you something like the answer to your question:
=COUNTIF(INDIRECT(CONCATENATE($A$1, "!$B7:$B")), "OK")
What you give up there is that the $B7:$B portion of your address is now a string, so if you copy this cell down the page, the 7 won't get updated to 8, 9, and so on.
There may be other combinations of functions that will get you closer: this is the one I arrived at with a few minutes of searching.

shorter solution:
=COUNTIF(INDIRECT($A$1&"!B7:B"), "OK")
and for dragging it would be:
=COUNTIF(INDIRECT($A$1&"!B"&ROW(B7)&":B"), "OK")

Related

Google Sheets: How to search/filter tabs by part of the name

I have spreadsheet with dozens of sheets with long names. It is very hard to find them in the list-menu etc. Is there a way to filter/find by part of the name?
The only way I found is to click Alt+/ and search for "Go To Range", and then type TheRequestedSheetFullName!A1 and jump. The problem is the names contains few words, and it is hard to hit exactly the correct name (I want filtering/searching by part of the name).
Yes. In the upper left corner of any sheet (to the far left of the formula bar), there is a field that, by default, shows the current selection in the current sheet. However, if you click in that field and start typing part of a sheet name, a list of all sheets that match will appear. You can then just click on the sheet you want from the shortlist that appears. By default, you will be brought to cell A1 of the sheet you select.
You can make a summary, then search with Ctlr+F
function listOfSheetsWithLinks(){
var ss = SpreadsheetApp.getActiveSpreadsheet()
var summary = ss.getSheetByName('summary')
summary.getRange('A:A').clear()
ss.getSheets().forEach((sh,i) => {
summary.getRange(+i+1,1).setFormula(`=hyperlink("#gid=${sh.getSheetId()}&range=A1";"${sh.getName()}")`)
})
}

How to quickly create a hyperlink to a sheet

I have a contents page of all the sheets in the document.
All of the cells listed under 'Rounds' and 'Data Input' have the same name as the sheet they are linking to, as you can see in the screenshot.
I was wondering if there is a way to create a link for all of these cells automatically, instead of going through every single one.
Thanks for the help.
I was able to do this by recording a Macro. Here are the steps I did whilst recording.
Delete all contents in the cells.
Paste in the array formula #player0 made me, into the first cell under the 'Rounds' column.
Select all the cells in the column and click on 'Convert to Links'.
Set colour to blue and underline so it looks like a link.
Here's the finished macro.

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 format a cell, only when it's not empty, based on the input of another cell?

I'm working on a spreadsheet in Google Sheets for multiple people, and indicate in a column who the person the information on that row pertains to. I want to format cells on that column, only when they're not empty, based on what person is selected in another cell.
I can create functions to format things based on another cell's entry, but I don't know how to compound that with a function for not being empty. Sorry if this is super basic, I just can't figure it out.
Yep. This is a super simple thing to do.
1) Highlight the column where the person's name appears.
2) From the main menu, select Format, Conditional formatting.
3) In the sidebar click add a new rule. what you want to do is create one rule for each name that appears (or could appear) in that column.
4) Under "Format cells if, select "Text is exactly"
5) Type the name in the cell where it says Value or Formula
6) Choose a background colour to suit.
7) Click Done.
8) Repeat steps 3 to 7 for each person; but change the background colour in each case.
Here's an example.

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?

Resources