Checkbox (or SOMETHING) to activate a row in Google Sheets - google-sheets

My wife runs a dance school, and occasionally needs to calculate the average age on a given date of a group of dancers. I'm not having a problem with the age calculation and averaging, but I wish to add a feature:
My sheet has all dancers in her company listed. Currently, we copy them all, paste to another sheet, and then delete the ones not included. That's a PITA, so instead I'd like to be able to put a checkbox in the first column, that when checked, would INCLUDE the associated age column in the calculation. So, she could just go down the list, click the included dancers, and it would calculate the average JUST for the selected ones and ignore everybody else.
Honestly, at this point, I have ZERO idea of where to start to do this and need a gentle push in the correct direction. Assume I'm an idiot and know almost nothing.

Here's an example sheet with the new checkbox feature to illustrate the function:
https://docs.google.com/spreadsheets/d/1G8LJyS10yi1HIa2MNHCbWUJPso9QAit3i0cO8A-Uw3A/edit?usp=sharing
I placed the formula above the "Age" column (Column C), and the Checkboxes in Column A:
=iferror(AVERAGEIF(A3:A,TRUE,C3:C),"NO DANCER'S SELECTED!")
This also displays an error message in case no dancer's are selected.

Try this. It looks for 'y' in column A. Assumes names are in column B and ages in column C. You can adjust the columns to match you sheet, and change the 'y' to whatever value you want to enter. It will average the ages of the rows with 'y' in column A:
=AVERAGEIF(A2:A,"=y",C2:C)

Related

Google Sheets VLOOKUP formula stops working when new item values are added to the column being looked up

Hello stack overflowers.
I have recently been creating a nutrition tracker to better track and control my nutrition. However I have run into an issue. So currently I have a 1 sheet in the nutrition tracker which is a "database" of foods and their macro nutrients per gram. In this sheet, I will enter all the foods that I generally eat and their associated per G nutrients.
this food "database" sheet has the following columns.
FOOD NAME, CALORIES, PROTEIN, CARBS, OF WHICH SUGARS, FAT, OF WHICH SATURATED, FIBER, SALT
This database is then used as a reference, so that when I input each meal as I eat it, I can simply select the food from a drop down list and type the number of G in that meal, and the nutrients will all be calculated for me.
I currently have it setup so that I can select food from the drop down list generated by "foods" sheet, within each meal table I have created. This is then correctly filling in the rest of the columns as expected once I input a weight for each meal. There is however a huge problem.
As soon as the FOOD NAME column of the Foods sheet had values in it below row 7 (not sure why this row is the limit) the whole thing stops working, the data grabs based on VLOOKUP just return 0 and do not act as they are meant to. The strange thing is they work absolutely fine until I enter too many foods (7 foods) into the foods sheet.
Please find below a link to my spreadsheet, maybe you can duplicate it and play around a little yourselves to better understand the issue.
https://docs.google.com/spreadsheets/d/1orwih7s_Z4ew8G1vJcR6qlxyMpX8pqK-3Ynj42qQjcQ/edit?usp=sharing
(if you help me fix it, you will have a free nutrition tracking spreadsheet to help you take control of your diet aswell)
Thanks in advance.
In the June tab, clear all formulas in the range D11:K18.
Then enter in D11
=ArrayFormula(IF(LEN(B11:B18), IFERROR(VLOOKUP(B11:B18, FOODS!A:I, {2, 3, 4, 5, 6, 7}, 0)),))
This single formula will process all values entered in B11:B18.
Note the third parameter of VLOOKUP (set to false). If it is ommitted (as in your formula) it will default to 'true'. That means vlookup expects a 'sorted order' which may not be the case for your data.
References
VLOOKUP
try:
=INDEX(IF(B11:B18="";; IFNA(VLOOKUP(B11:B18; FOODS!A:I; COLUMN(B:G); ))))

Formula only recognizes one submission

My goal is to make it so that the spreadsheet checks to see if the respective Web ID in Column B has an Active LOA as determined in Column I. An Active LOA being defined as one with an end date that has NOT yet passed.
I've gotten the formulas to work with the first entry. But if that first entry's date has passed (marked as Expired) and the entry after that one hasn't passed (marked as Active LOA) then the formula breaks down. It's as if the formula works only once.
The formula that checks the respective Web ID's in Column B of the "Roster" tab against the Web ID in the "ScD LOA Responses" tab is in cell F9 of the "Roster" tab.
The formula that determines whether or not the date has passed/whether the person is still on LOA is found in column I of the respective row.
You are getting wrong result on second row because you have lock the range on first row, change it as following should work properly:
=IF($F3:$F<TODAY(),"Expired","Active LOA")
You may try arrayformula also by only enter formula on F3:
=arrayformula(if($F3:$F="","",IF($F3:$F<today(),"expired","active")))
The issue for Roaster is not syn with the form submission is because Vlookup is limited to return first occurence unless you make so adjustment, here I will give a simple solution to always return the latest result for syn:
=iferror(index(FILTER('SC LOA Response'!C$3:$I,'SC LOA Response'!C$3:C=B6),COUNTIF('SC LOA Response'!C$3:C,B6),7),"")
Since your roster is fixed number, you can copy the formula on every row, hope it solve your issue :)

Google Sheets Hyperlink to Dynamic Field Within a Given Sheet

I have a Google Sheets document with a series of fields for every day in the year. The top row (Actually, row 2) is the Months (by full name, eg. January, February, etc.). The A column is numeric, from 1 to 31. There are several fields for each date, so the fields in the A column are merged (in other words, it's not A2, A3, A4 - more like, A2, A7, A12).
What I'd like to do is put a a hyperlink at, say, B1, that points to "today's" top field. So, today's would point to J7, and I could just click the link at B1, and get taken directly to that field.
I know this is going to involve the HYPERLINK function, but I can't figure out how to get it to work. Something like:
=HYPERLINK("#gid=0&#range=" & MATCH(TEXT(TODAY(),"MMMM"),2:2,0) & MATCH(DAY(TODAY()),A:A,1),"Click for today")
But I can't get it to work right. Any thoughts?
Assuming your months are in every column from B2:M2:
=HYPERLINK("#gid=*000000000*&range="&ADDRESS(MATCH(DAY(TODAY()),A2:A,1)+1,MONTH(TODAY())+1,4),"Click for today")
I wrote the formula so that the link could go in A1 without running into trouble, if you like. (It would also work in B1, etc.)
If there are spaces between your months, just reorder what you had so the MATCH for the row is first and wrap it in ADDRESS( row, column, 4):
=HYPERLINK("#gid=*000000000*&range="&ADDRESS(MATCH(DAY(TODAY()),A2:A,1)+1,MATCH(TEXT(TODAY(),"MMMM"),2:2,0),4),"Click for today")
(To be clear for future users, you'd need to replace the gid= number with the actual number corresponding to your sheet.)
Eric Tyler - Close. But it got me where I needed to be, so thank you so much. I was missing two key funtions: ADDRESS, and SUBSTITUTE. Here's what wound up working. (Note: In my case, the gid is 0.)
=HYPERLINK("#gid=0&#range="&SUBSTITUTE(ADDRESS(MATCH(DAY(TODAY()),A:A,1),MATCH(TEXT(TODAY(),"MMMM"),1:1,0)),"$",""),"Click here")
The ADDRESS line the way you proposed it results in the address in the format $A$1, which the HYPERLINK function doesn't like. Using that just brought be to the sheet, but not the actual cell. By using SUBSTITUTE to get rid of the $ marks, that resolved the problem.)
Thanks again!

is it possible to lookup a cell value and populate a drop down box with the results in a separate cell

I have a google sheet with all current staff information. I have a second sheet for when some piece of data needs changed. Last name, Location, job ect.
on second sheet I am looking to have someone:
Enter the user's first name in column B,
and or Last name in Column C,
I would like a drop down box generated in column D from the given info to contain all usernames found in the sheet with current information for all staff that have the given first and or last names provided.
Once a username has been selected, I can get all the pertinent data from that user with a vlookup from the sheet containing all staff info. For example if someone typed Scott in column B, I would like a drop down generated in column D with all staff that have a first name of Scott. Likewise if the last name was supplied and of course if both first and last was supplied.
Validation need to be done that's it,
1) Go to Staff Changes'!B2 and Data Validation> List from range & choose range from 'Staff Info'!B2:B
2) Select cell'Staff Changes'!D2 and Data Validation> List from range & range will be filter formula i.e 'Staffing Changes'N2:N.
Result
Few tweaks in vlookup:
I am not sure if you need username column twice if you don't need then change your vlookup formula from =vlookup(D2,'Staff Info'!A:K,10,0) to =VLOOKUP(D2,'Staff Info'!$G$1:$K,2,0)
Please provide access to trix in future so that changes & result can be shown in it.
UPDATE:
Use data validation as before & hide filter colum or use seperate sheet for filter formula & use query function in cell A3 =QUERY('Staff Info'!A:J,"select ' ',A,F,' ',' ',G,' ',I,' 'where A='"&A2&"' AND F = '"&B2&"' LABEL ' ''Date',' ''Current Last Name',' ''New Last Name',' ''New Building',' ''New Classification'",1) result wil be something like this
QUERY

Google Sheets, need to edit a column based on two columns on a second sheet

Good morning!
I've been searching high and low for how to do this, and while I feel like I get close I can't get anything more than 'invalid formula' from the conditional formatting in google sheets. So here's what I'm trying to do;
Column C on sheet 1 (Working List) needs to have a red background if the following conditions are met;
Column 'P' on sheet 2 (Complete) has the 'Address Changed' option in the drop down box (its the first one on the drop down, I've been struggling to figure out if it needs to be a '0' given its position in the list or if its 'Address Changed')
Column 'C' on sheet 2 has the same account numbers in Column 'C' on sheet 1.
I can set it up to find duplicate accounts, but I can't seem to figure out how to get the first rule for the drop down box to work. Advice?
Attempts thus far, none of them worked, all were tried separately and not in conjunction with each other. Google just says 'invalid formula' and won't save it or do anything with it.
=and(EQ(Complete!$O, "Address Changed"), EQ('Working List'!$C, Complete!$C))
=match($C2, indirect("Complete!$C:$C"), 0)
=if(EQ, indirect("Complete!$O, "Address Changed""), EQ('Working List'!$C, "Completed!$C"))
=and(indirect("Complete!$O:$O,$O="Address Changed""))
so I've tried to figure out a better way to get it working, and this is what I think might be closer to the answer.
=and(if($O:$O,indirect("Complete!$O:$O),0)),[match($C2,indirect("Complete!$C:$C"),0)]
***Friend helped me solve this. The following worked for what I needed....
=index(indirect("Sheet2!O:O"), match(C1, indirect("Sheet2!C:C"), 0)) = "Address Changed"
Take a look at this sheet with some foo data I built based on your sheet.
https://docs.google.com/spreadsheets/d/1RcM5WX3KWgWq-WWuPgyF-PZe3RP99qWF-IRpSr35Zik/edit?usp=sharing
I used some helper column, as you see.
if sheet2!P1 is changed to "Address Changed" K1 will have value of 1. This is a simple IF function.
if sheet2!C = sheet1!C, L will change to 1. This is another simple ARRAYFORMULA(IF())
Finally, column C will be formatted with the data from K1 and L by this formula
: =AND(L2=1, $K$2=1)
You can then hide the helper column / cell.
If you don't want to use helper column, look at the formula in column D :
=AND(INDIRECT("Sheet2!C2:C") = C2:C, INDIRECT("Sheet2!P1")="Address Changed")
This will serve your purpose.
You cannot refer to another sheet directly in conditional format formula, hence if you don't want to use helper column, you will have to use INDIRECT. This is also the reason why your formula failed in the first place.
I personally wouldn't recommend you to use INDIRECT though...

Resources