Google Sheets - Calling row based on cell reference - google-sheets

I am a coach and have a google sheet that tracks their fitness with a numeric score, higher being better. Each score has paces assigned to it for easier runs and harder runs. Currently I have a sheet that is a table of the scores with the prescribed paces, and to simplify the matter, I made the score the same as the row number. I then have another sheet with the athlete names and their score.
I would like to populate that athlete sheet with their paces as well. I know how to do this manually (like ='Score/Paces'!B50), but I would like it to automate this process. Let's say an athlete has a score of 50, stored in cell C2. Then:
Instead of this: ='Score/Paces'!B50
it's something like this: ='Score/Paces'!B(C2)
This way, whatever the score is automatically changes the paces for the athlete and I won't have to copy and paste every time.
Here is a link to the example I made. I filled the cells with things I've tried. https://docs.google.com/spreadsheets/d/1FXI_RIevvkuUOkNwBPK4l-oblIZcYm9Fw459KIvq5Jw/edit?usp=sharing
Thanks!

use:
=INDIRECT("Score/Paces!B"&C2)

Related

Make a COUNT list

Good morning,
I have a dynamic list of all used words in a certain file.
When I type something D2, it scrapes new data.
This new data then gets =unique in F75:AH100.
This data then gets listed in Sheet B.
Next step would be to put a count of all the unique data in Sheet B. This so we can see the importance of a certain string with multiple scraped data points.
Can this be done with a formula or should I use a script?
Example file: https://docs.google.com/spreadsheets/d/14ewg-2oJHe1GWaeY_zoRvaxKSWYDnPkiyOlTE_C504w/edit#gid=0
If there is anything unclear, please let me know and I will update this topic as soon as possible!
I know the formula used for Sheet B is dynamic and will change when new data is entered in A. I already have a script for that.
Thinking logically it should be something in the line of
"If cell is counted, then take that value as minimum, and then go on with normal count"
try:
=INDEX(COUNTIFS(B3:B; B3:B; ROW(B3:B); "<="&ROW(B3:B)))

In Google Sheets grab the SUM of every cell where neighbouring cell is not empty

I’m trying to create a sheet for a cycling team where they need to register training participation and km riden.
Every rider has a column where they get a check for when they participate in the training. They get the group number they had (1,2,3), or a D if they where on the defect team.
In another sheet it's registered how long the training was.
This is then referenced in the bottom.
Why I need is in the last cell to sum up the distance they've ridden in relation to their participation.
Training sessions
So in this example
They've had 4 training sessions. The distances registered in the bottom row.
Thomas participated in 3. He's ridden 148k in all in the 3 sessions.
Trine participated in 1. She's ridden 49k in the one session.
I have tried to manually validate every cell and grab the coerresponding value like this.
=IF(ISBLANK(D4);0;$D$54)+IF(ISBLANK(E4);0;$E$54)+IF(ISBLANK(F4);0;$F$54)+IF(ISBLANK(G4);0;$G$54)+IF(ISBLANK(H4);0;$H$54)+IF(ISBLANK(I4);0;$I$54)+IF(ISBLANK(J4);0;$J$54)+IF(ISBLANK(K4);0;$K$54)+IF(ISBLANK(L4);0;$L$54)+IF(ISBLANK(M4);0;$M$54)+IF(ISBLANK(N4);0;$N$54)+IF(ISBLANK(O4);0;$O$54)+IF(ISBLANK(P4);0;$P$54)+IF(ISBLANK(Q4);0;$Q$54)+IF(ISBLANK(R4);0;$R$54)+IF(ISBLANK(S4);0;$S$54)+IF(ISBLANK(T4);0;$T$54)+IF(ISBLANK(U4);0;$U$54)+IF(ISBLANK(V4);0;$V$54)+IF(ISBLANK(W4);0;$W$54)
This works. But it's a nightmare to maintain.
If there's a session added, I have to dig through and add yet another IF statement in there.
Is there a better, hopefully a dynamic one, which addresses extra sessions??

Why do dates change in DATEDIF when I add a new row o data?

I am trying to create an athlete database, using input from the athletes, via a Google Form, which links to a spreadsheet.
Each question on the form corresponds to a matching column on the spreadsheet. Apart from the fact that I don't seem to be able to direct replies directly into the spreadsheet (they appear in a separate sheet) everything works acceptably...
However - and there's always a however - I want the athlete's Date of Birth to generate their current age, so I include another column, which - using DATEDIF - gives this figure.
The column isn't on the form, so I have to create it separately for each new entry - currently well over 700 athletes on the database and more to come.
Here's my problem... I have manually linked the DATEDIF formula for every single athlete, using their DoB cell and the A1 cell as TODAY. They all work.
Until I add another entry. Then, below that new entry, although DATEDIF seems able to keep track of the DoB cell for every athlete displaced by the new row, it also adds a row to TODAY, so A1 becomes A2, A3 if there are two new entries, and so on.
Rather than making every single cell in column A into TODAY, is there a way to apply the DATEDIF formula to stop changing A1 as my reference?
This is the formula I am using: =DATEDIF(H2,A1,"Y") my dates are all in dd/mm/yyyy format. The athlete DoBs are all in column H, TODAY is always A1...
This is so far above my head, I seem to have created a beast that I cannot tame, other than by inserting new rows and then re-pointing hundreds of DATEDIF formulae to the correct TODAY cell. And life is too short for that!
Any help greatly appreciated...
Short answer
Use
=DATEDIF(H2,$A$1,"Y") or
=DATEDIF(H2,TODAY(),"Y")
Explanation
Google Sheets references could be relative or absolute. A1 is a relative reference, $A$1 is an absolute reference.
By the other hand, you could use a function as a function parameter.

Number increment in Google Sheets formula

In a Google Sheets database, I have a formula which I have built in order to allocate a reference number to a series of companies.
Each company should have its unique number in the form of RET00XX where XX will represent the unique company number. I would like these numbers to be sequential, starting on 1 and going on +1 after that.
Whenever a new company is inserted in the database, the formula should be able to attribute it a reference number. It should also be able to verify if the company already exists in the database and, if so, automatically attribute it the company's unique reference number, instead of creating a new one.
The company names are in cells of column B.
This is the formula I have built (an example of the one in row 2):
=ARRAYFORMULA(IF($B2<>"",IF((COUNTIF($B$1:$B1,$B2)>0),INDEX($A$1:$R2,MATCH($B2,$B$1:$B1,0),12),CONCATENATE("RET00",ROW($B2))),""))
The steps it takes are:
It verifies that column B in the correspondent row is not empty;
With the COUNTIF function, verifies that the company does not exist in any of the previous rows;
If the company does exist, it attributes the correspondent reference number through the INDEX function;
If the company doesn't exist, it attributes the company a new reference number with the CONCATENATE and ROW functions.
The formula is largely working, although there are some problems.
Users adding to this database have the habit of adding entries by inserting rows in the middle of the database. This makes it so, due to the way the formula is built, that company unique reference codes change each time that happens. I believe this is partially due to the fact that I use a ROW function. Also, given that new rows are inserted in the middle of the database, the formula should be able to verify is the company already exists not only by looping through all previous rows but rather through all rows (if a new row is inserted, the formula will only verify previous rows, when the company could be in the rows after the new one).
How can I attribute sequential numbers in a formula without reference to ROW? Also, how can I make sure that the spreadsheet verifies for all rows of column B instead of just the ones before the inserted row?
apply this formula in your sheets,
=ArrayFormula(if(B2:B<>"",row(A2:A)-1,""))
More information regarding this please visit this link : https://infoinspired.com/google-docs/spreadsheet/auto-serial-numbering-in-google-sheets/
Solution that is independent of starting row number
These examples will allow you to generate incrementing values in your formulas.
Incrementing integers, zero based:
The values will be: 0,1,2,3, etc.
Note: The address "$A$2" represents the cell of your top row. It should be changed to whatever cell your actual top row is. The nice thing about this method is it it will not break if you insert new rows above the start position of your formula.
=(ROW()-ROW($A$2))
Integers, one based:
The values will be: 1,2,3,4, etc.
=(ROW()-ROW($A$2) + 1)
Dates:
The values will be: 2000-01-01,2000-01-02,2000-01-03, etc.
=Date(2000,1,1) + (ROW()-ROW($A$2))
All Even Numbers:
The values will be: 0,2,4, etc.
=(ROW()-ROW($A$2) * 2
Short answer
Use Google Apps Script
Explanation
Using spreadsheet functions to set an ID on a live spreadsheet used as a database is very risky as the values will be recalculated when changes be made to the spreadsheet content.
Instead of using a formula use a script to add a "fixed value". Scripts could be called automatically on events like cell edits and row insertion, by using a custom menu or side panel, from the script editor or by time-driven triggers.
The following Q&A from Web Applications shows several ways to set a sequential number:
Can I add an autoincrement field to a Google Spreadsheet based on a Google Form?
This other from SO could be helpful too:
Auto incrementing Job Reference
Insert 1 in the first cell and paste the formula below in the following cells.
=INDIRECT(ADDRESS(ROW()-1,COLUMN())) + 1
Add number on very first row and type the formula from next cell
i used =A1+1 to get incremental number to index tasks on each line.

How does one import filtered data from “Sheet2” into “Sheet1?

Objective: import filtered data from “Sheet2” into “Sheet1.”
Data is filtered in “Sheet2”, an expense table with dollar amounts in column A, and categories such as “fuel”, “meals”, “parking”, etc. in column B.
I understand that one way to do it is to make a separate sheet for each category and SUM those amounts, and import them into “Sheet1”. I am able to do that, however, I would like to use one sheet and some method to do the following:
In “Sheet2” filter the data for a determined category and display a SUM for that category in a predetermined cell in “Sheet1”.
I have shared the sheets here.
If I am shown how to do this for one category I will be able to copy and paste the function into the appropriate cells in “Sheet1” for the remaining categories.
I am aware that I may not be asking this in the best way. Thanks for all your help.
~ Joe D
=sumif(Sheet2!B:B,"fuel",Sheet2!A:A)
The above formula works for fuel, simply change "fuel" to whatever you are trying to sum.
If you wanted to change what was in Sheet1, cell A1 to fuel instead of fuel total and changed all the other values in column A to match. Removing total (remembering to remove the space too)
You could then use this formula in cell B1, drag it down, and as new expenses were added. It would look at the name of the expense and sum it.
=sumif(Sheet2!B:B,A1,Sheet2!A:A)
If you didn't want to take out the total then the following formula should work if placed in B1 and dragged down.
=sumif(Sheet2!B:B,SUBSTITUTE(A1," total",""),Sheet2!A:A)

Resources