I am working on a stats tracker for a game using a Google spreadsheet and as you can see in the linked image below, D2 is subtracted from D3 to give F3 a value. The E and G columns have the same relation.
My issue is, while the formula is simple (i.e. in F3 type, =d3-d2 , to get a value), typing this formula 100 times altogether is a bit mundane.
Is there anyway that I can have this done automatically? I have more features I'd like to add, but I am holding off because of this issue.
Hopefully this link works, I don't have enough rep to post an image. http://imgur.com/cyh27np
You do not need to type the formula for each cell, you can just select the cell, copy it and paste it on the cell below. The cells referenced are relative to their position so they will change accordingly.
For example in your case, if you select and copy cell F3 and paste it on cell F4 you will see that the pasted formula will actually be =D4-D3
Just left-click in the bottom right-hand corner of the formula you want to copy (or even number sequence), and drag it down or across however many cells you like. The program will recognize the pattern and continue it accordingly.
Related
We track workshop registrations in a google sheet and I'm trying to conditionally format a range of cells (A7:P14) based on the text in cell E7 (Eng DLO, Eng TBC, Sp DLO, Sp TBC).
I used the formula
=COUNTIF($E7:$E, "Eng DLO")
and A7:S14 turned the selected color (light purple). When I then added conditional formatting to turn dark purple with the formula
=COUNTIF($E7:$E, "Eng TBC")
the color wouldn't change when I changed the value in E7 from Eng DLO to Eng TBC.
I know the issue is that I need it to EXACTLY MATCH the text and I tried incorporating EXACT into the COUNTIF formula, but it would only highlight E7 or just A7:P7 instead of the whole selected range in the conditional format (A7:P14).
Here is a sample sheet with what I am hoping it will eventually look like once I get the conditional formatting to actually work (I removed the conditional formatting). https://docs.google.com/spreadsheets/d/1Bn9FVTHE1OO49p4PKo6j0Qd3c0NX6pUq3vp0pHFNGVI/edit?usp=sharing
Got a couple other issues here:
The 7 is a floating reference, so you need to fix it with $. This is the reason your formula isn't working. In the next row, it would start counting in cell E8. With the $, it works, but less efficiently than it could, which brings me to point 2.
If you're only referencing one cell, just check for equality against that one cell.
To the Eng TBC, you would use
=EXACT($E$7, "Eng TBC")
Just to demonstrate a point, without the dollar sign, the next rows cells would have been checking against this:
=EXACT($E8, "Eng TBC")
Which of course would have been empty.
A More Flexible Solution
Since you probably don't want to keep having to reformat per set of cells, you can use a ROW-based approach to tackle the issue. This one, for example, assumes 8 seats per group.
=EXACT("Eng DLO",INDIRECT("E"&(8 * INT((ROW() - 7) / 8) + 7)))
Every 8 rows, it references the next multiple of 7. (Yes, INT is FLOOR, but shorter.)
I am using a google sheet as a database. When a row is populated (using JSON API and Integromat), I want formulas in the newly added row to update. However, I cannot get the formula to be applied to the whole column automatically.
For instance, C1 is =A1+B1. When A2 and B2 are added, C2 should be =A2+B2.
I have tried:
Double clicking the box in the bottom right corner of the selected cell. This does not work because it adds the formula for all rows that contain data. When a new row is added, the formula is not applied to that row.
Using the formula with a range =A1:A+B1:B. This formula is only applied to the selected cell.
Pasting the formula in the column header. This simply did not work. Even when I tried to include a formula that used a range =A1:A+B1:B.
Using hotkeys like shift + ctrl + Down + D. I was unable to find any that worked. Most were for windows computers (I am using a mac).
I'm sure I'm just making a stupid error, but I haven't been able to find any solutions.
Thanks in advance!
Place this in the header row (assuming the header row and you want to add all other rows).
={"YOUR HEADER";ARRAYFORMULA(A2:A+B2:B)}
I'm back with another Google Sheets question. This one isn't scripting though - this time I'm looking for help in figuring out a formula.
I've attached screenshots of two sheets. The first one features one "opposing party" at row 8. The second one features an opposing part at row 8 and a second opposing party at row 9. Cell B3's formula is shown in both; in essence, Cell B3 looks for the first blank cell in column L after Row 10 (or Row 11 in the second image) and returns the contents of that row's "F" column. This allows me to "get" the next deadline in the matter that is being tracked. For those interested, yes, Cell D3 has a similar formula looking at K.
Currently, we have to manually update B3 (and D3) if we add additional parties (not necessarily opposing, and not just one either). This is more tedious than I would like. I would like a formula that would return "F10" and "L10" in situations where only one opposing party appears, "F11" and "L11" if there is an additional, and so on so that even if we have a massive, multi-party action it will still return the next cell.
If it helps, you can always assume that there will be a blank set of cells below the last "opposing party" and the row that we want to start querying (as shown in the second image).
I'd love any help that you can give. Please let me know if you need anything clarified.
Thanks a ton!
--Databoy2k
Is this what you require for B3?
=index(F:F, match("rule", I:I, 0)+1)
In a larger scope use,
=index(indirect("F"&match("Rule",I:I,0)&":F"), match(TRUE, index(isblank(indirect("L"&match("Rule",I:I,0)&":L")),0,0),0))
I think the easiest way would be to make the cells you are referencing a named range. That way, you can add as many other rows, columns, cells, whatever, and your formula will always reference the same range of cells.
For example, you could name the range of cells in column F 'Steps', and in K 'Deadline', then change your formula to =index(Steps,match(TRUE, index(isblank(Deadline),0,0),0)), and it will always give you the correct range.
Here's a pic to show how to name a range (right-click on the selection).
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.
Say I have 2 columns: (this is extremely simplified)
Data = a number
Result = Data * 1.2
I can put B2 = A2*1.2, then drag and drop B2 down...
and it fills all the other cells, which is perfect.
But can I put this multiplier (1.2) somewhere as a "constant"? (for clarity and being easily editable)
Say I put it in E1, and set B2 = A2*E1.
Now I can't drag and drop anymore (because E1 becomes E2 E3 and so on)
In this example, is there a way to make E1 stay as you drag it down?
Short answer
Use an absolute cell reference or a named range
Explanation
Instead of E1, which is a relative cell reference, use $E$1 which is an absolute cell reference.
An alternative is to to assign a name to the cell E1, let say, "constant"
In the first case the formula will be
=A2*$E$1
In the second case
=A2*constant
References
Spreadsheet - Wikipedia
Name a range of cells - Google Docs Editors Help
I understand that you are asking for "A “constant” in Google spreadsheet?" and later on a "drag down" solution.
You can use the accepted answer, OR ...
Instead of having to drag down (increasing the number of formulas)
Use a single formula in B2
=ArrayFormula(A2:A6*E1)
You can even use it for future entries or now blank cells.
=ArrayFormula(IF(A2:A11<>"",A2:A11*E1,""))
How the formula works
The ArrayFormula will apply the calculation cell*E1 in every single row, IF the cell is not empty/blank "".
IF it is a blank cell it will return a blank cell "".
Functions used:
ArrayFormula
IF
Can you try this in your formula?
Cell B2 type
=A2*$E$1
Then there is no need to drag it down on column E, it will all follow E1.
I believe this solves the problem.
If you really want to drag it down, then why not just put Cell E2
=E1
So that even when you drag, the value will remain 1.2