I am using the Spreadsheet gear component and need to select all cells in a worksheet so I can apply a consistent font setting across. How do you create an IRange that represents an entire worksheet?
IWorksheet.Cells represents all cells in a worksheet:
workbook.Worksheets["Sheet1"].Cells.Font.Color = SpreadsheetGear.Colors.Yellow;
Related
Can you please help me to understand how to build a diagram (smooth line) that is basing on RED values (BLUE category) per GREEN month?
Table in google sheets
I have no idea by this time how to do it - I think diagrams cannot understand multiple values if I just select them separately.
I tried to select individual cells that I need to build diagram for, but it does not work, since it cannot understand that I need to bind the selected cells with months and category names..
The way of doing this would be:
Select the first cell of the series
Insert chart
Select type: smooth line chart
Click on Select data range (button on the right of the Data range input)
Click Add another range and add the other cells one by one, and then click OK
Set Combine ranges to Vertically
And the graph should appear
In Excel, it is quite easy to filter rows based on a list from another sheet. But, Google Sheets does not have an advanced filter option. It therefore is not possible to filter a column by list range and criteria range in the same way that one would in Excel. So, how do you filter rows based on a list from another sheet in Google Sheets?
Worksheet to Be Filtered
Worksheet with Filter List
Select A1:C11
Create a Filter
Select A1 Filter dropdown
Custom Formula:
=OR(IFERROR(MATCH(A2,customer!A$2:A$3,0),0),IFERROR(MATCH(B2,customer!A$2:A$3,0),0))
Both A2 and B2(HGFD and MNCD and all the respective rows below) are checked against customer!A$2:A$3. If A or B contain anything from the Customer list,It'll be shown. A2 and B2 are representative of the whole A and B column.
Alternatively,
=FILTER(A1:C11,IFERROR(MATCH(A1:A11,customer!A$2:A$3,0))+IFERROR(MATCH(B1:B11,customer!A$2:A$3,0)))
This is the guide I used that worked for me in Excel:
Select a blank cell next to the rows you want to filter, and enter this formula =COUNTIF(Sheet2!$A$2:$A$6, A2), and press Enter, then
drag the auto fill handle down to apply this formula to the cells.
Select the column including the formulas, and then click Data > Filter to apply Filter function.
Click the Filter icon in the formula column, only check 1 in the drop down list.
Click OK. Now the rows have been filter based on the list in Sheet2.
I've searched for hours and couldn't find an answer to the following problem:
I have two sheets, Blue and Red.
I want Blue!A1 to be "exactly" like Red!A1 but I find this problem:
Red!A1 contains "B1+B2", both are Red's cells.
However, when I write Blue!A1 like this: "=Red!A1", the return value is something like "=Red!B1 + Red!B2", and not the "=CurrentSheet!B1 + CurrentSheet!B2"
My problem is that I cannot reference the Blue sheet in the Red one because I want dozens of sheets referencing Red in the same way, so when I change A1 in Red I change all the other sheets' A1 accordingly with their respectives B1s and B2s, not Red's B1 and B2.
I want to have a cell in a sheet which can be referenced by any other cell in any other sheet exactly like it was in the first place.
For instance, if I have a cell which contains =B1+B2 in a sheet, I want to reference it in another sheet in a way that the new =B1+B2 references the current sheet's B1 and B2 cells instead of the former one's.
Can someone help me to solve this problem?
Thank you in advance
Alexandre Trajano
Solution 1
Copy & Paste.
In Google Sheets, copy & paste iterates the formula automatically. If you change sheet, it will change the referenced cells to point to the current sheet; if you change location within the same sheet, it will shift the cell references according to how many columns and rows you shifted.
In contrast, cut & paste will move the formula without iterating the cell references.
Solution 2
If you have a truly large number of sheets you want to create based on a template and don't want to c&p a thousand times, you can use Apps Script.
In particular, you will need
Spreadsheet App to create and access new sheets; and
Functions that manipulate cells here.
You can enter the formula via Apps Script as strings.
For example, say you want cell A1 to have formula B1+C1 in a tab named "Sheet1". You can do the following.
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var tab = sheet.getSheetByName('Sheet1');
sheet.setActiveSheet(tab);
var cell = tab.getRange(1, 1); // The arguments are the row and column indices of A1, respectively.
cell.setValue('=B1+C1');
There are many things you can do here with the basic template. You can generate sheets based on some naming convention. You can generate formula based on the cell position. You can create a script that fills in the formula upon the creation of a tab if its name observes a certain rule. etc etc. And naturally, you can duplicate the formulas from one sheet. You will need getFormula() as opposed to getValue.
Note: you can also call
custom Apps Script function directly in your sheet and write your cells using the output of your custom function. But in your case, using the range functions in Apps Script should be more efficient.
Is it possible to grab the contents of a cell from one sheet and display them on another?
I have 4 sheets. And I want the cells of the third sheet to display the first column of the second sheet on the second column.
if you want to get range from another sheet just use:
Replace 'Sheet' and 'A2:C8' with title and range you want to refer
={Sheet!A2:C8}
For multiple sheets
Replace ';' with ',' for horizontal view:
={Sheet!A2:C8;Sheet1!A2:C8;Sheet2!A2:C8}
Add the sheetname exclamation point to your cell reference
e.g. sheet!A:1
Then drag from the first cell down to as many rows as you need.
Google Sheets allows reference between sheets. the syntax is pretty simple. consider a single cell: =<sheetname>!A2 for example. From there, you can drag down with the bottom right corner, and your your column will now be a copy of an arbitrary column in , in this case A
These are the annotations for cells in google sheets
Sheetname!A:1 For Relative Cells
Sheetname!$A:1 For Absolute Columns
Sheetname!A:$1 For Absolute Rows
Sheetname!$A:$1 For Absolute Cells
Yes. For specific ranges you can use IMPORTRANGE.
Is it possible to grab the contents of a cell from one sheet and display them on another?
Yes. It's even possible to get entire columns of data.
In sheet 2 A1,
=ARRAYFORMULA('Sheet1'!A:A)
The single quotes ' can be omitted, if the sheet name doesn't have a space . In other words, if you use Monthly Budget as a sheet name, then single quotes is mandatory.
I have data listed in columns as below and by highlighting it all including the names and the units and then clicking Insert -> Diagram..., I can easily make the following graph:
The labels are correct LabelA, Labelb, and LabelC in this case.
But if the label names are not in the same column as the data, then I cannot make this graph. In the data structure below where names and data are in different columns, I again highlight all data cells as well as their units and names (by holding down the ctrl button and clicking all the cells with the cursor):
It is clear that the software does not know that it should assign the names as labels. Is there a method to make the graph show the correct labeling as in the first scenario but with the second scenario's data structure?
you could combine the data in another place with formula:
={{A1,C1,E1};{B4:B6,D4:D6,F4:F6}}
and then plot the diagram as usual.