I am creating a spreadsheet to be used among 40 teachers to assign students to a variety of classes. Student names are in rows while the classes are in columns. As students join a class, there is a cell in the column that adds the total number of students who have joined the class. When the class reaches a specific number, I would like the column to change colors to indicate the class is full or completely lock the column so no more students may be added. Can anyone help?
Richard, if you just want to colour the column, you could try conditional formatting like so:
Pick the range of columns you want to be colour coded
Apply the custom formula =B$1>3. This means that for each column in the range, the formula will look at the first row in that column - that is why the $ is in front of the row number and not the column letter - and if that number is greater than 3 (class capacity), then the column will turn red(ish).
But if you want to lock the column, you'll need to get into Google Apps Script.
Related
I have a lookup table that classifies the names of columns. For example, the column names are goat, mouse, and butterfly, and the classification table shows that these column names are mammal, mammal, insect, respectively. For each row, I need to sum all columns that belong to the 'mammal' class. See picture below (my firewall may not allow the picture, so I can try again at home).
What I currently have is just returning the first column match, instead of all columns that match 'mammal'.
=sumif($B$1:$F$1, vlookup("Mammal", $K$1:$L$5, 2,0),B2:F2)
One little curve ball is that this sheet is going to be dynamic. People will be adding animal columns and classifying them in the lookup table, and I don't want them to be editing the formula.
How about this formula:
=SUMPRODUCT(B1:F1,N(IFERROR(VLOOKUP(B$1:F$1,{L:L,K:K},2,0))="Mammal")))
then drag it down?
I'm currently trying to get the last value of Column "D" in several sheets, then add all the values together, then calculate a percentage based on a value from a main sheet cell.
I can get =VALUE(D:D) to work and =VALUE(Animations!D15), but not a combination of both which is what I need (since the size of the column will continue to grow).
It would be best if it was the last numerical value in column D, and not account for blank spaces or strings.
Thanks!
To find the last populated number in a column use Index with an approximate Match to 1E+99.
=index(sheet2!d:d, match(1e99, sheet2!d:d))
The above retrieves the last number in column D on Sheet2.
Google sheets will not process an array of worksheet names through INDIRECT like Excel will but a 'helper' column will take care of that. If you want to hard-code a series of worksheet names into a sum of index/match formulas, then Indirect isn't even necessary.
In the accompanying linked worksheet, I've used this method to retrieve the last number from columns with numbers, text and errors. I've thrown in the 'last number' cell address as well.
Linked spreadsheet
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.
I want to create a gradesheet using google sheets, each assignment grades are entered as letters (A thru F). Each grade is given a numerical value - decided dynamically at the end of course.
I want to create a gradesheet in which I can enter each students grades as letters and in the end while calculating the final grade each letter is converted to a number and totalled.
Is there anyway to do this in google sheets.
I suggest you set up a little table as highlighted in the image and name it (I chose GTable):
then apply a lookup formula such as:
=vlookup(A1,GTable,2,0)
If you do so without some kind of table then you may be trying to fix formulae each time the dynamic decision is changed, and fixing a table may be easier.
You could create a second gradesheet based off of the original gradesheet, but instead of letter values, each cell would have something like
=IF(B2="A",100,IF(B2="B",90,IF(B2="C",80,IF(B2="D",70,IF(B2="F",60,0)))))
In this case, B2 is the cell corresponding to the original gradesheet, so each cell in the new gradesheet would correspond to a cell in the original gradesheet. You can then replace the hardcoded numbers with values from the spreadsheet or expand the conditional to cover more letter grades, and use this new table to calculate the final grade.
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)