I'm trying to set up a conditionally formatted training record. I have a separate sheet that shows job titles and X's for required training. Because conditional formatting cannot reference other sheets, in the actual training record I copy the previous sheet (=Sheet1!A1). In the record, there's a drop-down to select job function.
My formula works, but only for the current column and to the right. Column 1 will work for any column (job title), but column 3 can only read job titles on column 3+.
I've tried moving the source data to the right (so the job titles copied from the first sheet start at BB300 instead of B300) but it has the same issue. Locking down the column letter with $ screws up the formula.
=if(AND(B3="",OR(AND(B$2=B$300,B301="X"),AND(B$2=C$300,C301="X"),AND(B$2=D$300,D301="X"))),True,False)
Sample copy of sheet https://docs.google.com/spreadsheets/d/1q0ImPv7FAeDNgz_adOyedcmA2RCot-UzI7nBByMWNiM/edit?usp=sharing
This is a shortened version of the code I'm using, but the idea is that B2 is the job title for the first person, C2 is the job title for the second person, etc. The script checks to see if the job title in B2 matches B300 (the copied requirements from sheet 1) and if so, checks if there is an X. If so, the cell colors (due to the conditional formatting being true) unless there's an X in the cell to show training is completed.
This works appropriately for the first column, but in column 2 (second employee) if I select the job title in column 1 none of the cells flag appropriately (are all blank).
...because conditional formatting cannot reference other sheets...
actually it can. you need to use INDIRECT for that. example:
=A1=INDIRECT("Sheet1!A1")
...to compare if A1 from current sheet Sheet2 is equal to A1 of Sheet1
_____________________________________________________
in your sheet Training Requirements add one row above header row and hide it:
then you can use this custom formula:
=INDIRECT("Training Requirements!"&ADDRESS(3, MATCH(B$2,
INDIRECT("Training Requirements!2:2"), 0), 4)&":"&SUBSTITUTE(ADDRESS(3, MATCH(B$2,
INDIRECT("Training Requirements!2:2"), 0), 4), 3, ))<>B3
spreadsheet demo
Related
Want to ask if there's a quick way, an automated or using formulas for this scenario.
So I have "config" sheet, and each columns is a list used for a specific dropdown.
config!A:A = clientA
config!B:B = clientB
In a "summary" sheet, I need to add a dropdown in column C depending on the column A
For example summary!A2 contains "client A" so the dropdown in summary!C2 will show the list of clientA
And summary!A3 contains "client B" so the dropdown in summary!C3 will show the list of clientB
What I currently do is named the range each in the "config" then in "summary" I put the Data Validation for the specific name.
I was wondering if there's a custom formula that I can put in the Data Validation for Column C that depends on the value in column A. The only challenge is there are spaces so in the Named Range I remove the space. And since it depends on the column, the row number is moving.
Looking for a formula since I am avoiding App Script for this specific file. Thanks
Hopefully someone could help me on this.
Thanks much.
You are all awesome!
What you can do is set an Auxiliary sheet (or extra columns far in "Summary"). You can set Summary!C2 the next Data Validation:
=Auxiliary!A1:1
Open the settings of that data validation and make sure there are no anchors (no $, for example A$1). If there is some, delete them
Close it and then copy and paste special - Data Validation only to the rest of the cells
This way C2 will be associated with row 2 from Auxiliary, C3 with row 3 and so on
Then, you can go to Auxiliary and set a formula in each row to filter the values according to B2, B3 (or however you identify the client... (a Query, or Filter) --> You'll probably need to transpose the information, so the list becomes a row
With that done, each data validation will depend now on the value of that row
Re-reading your example, you can do the same but instead of filter you can transpose the entire Config sheet and you'll have a row per client
......
You have an example here: https://docs.google.com/spreadsheets/d/1jF5XoBkQll5tHEjADg508NMznmbuB43tyWv5R2S1mM8/edit?usp=sharing
I have a Google spreadsheet with 5 tabs (sheets) and I want to copy rows of data from one sheet to another, IF a criteria matches in one of the sheet.
Sheet1 has hundreds of rows of data, across numerous columns. One of the columns lists dates. That column is mostly set to Date format. That date col also uses various Conditional Formatting rules. (I cannot change these or the formatting of this column!).
In sheet5 I have a formula that is supposed to look at sheet1 and find all the rows with a certain date in the date col and then copy the data in that row to a row in sheet5.
It looks like this: =INDEX(sheet1!$A1:$O2002,MATCH($B$1,sheet1!$Q:$Q,0),0)
It kind of works... if I just paste the formula in one cell in sheet5, it finds a row matching the date criteria and copies data over. But if I want to query more of sheet1, by dragging the cell down and find more rows of data to copy over... it just copies all the rows from sheet1 after the initial find... completely ignoring what it's comparing in $B$1 to $Q:$Q... I suspect that what I think it's comparing in MATCH($B$1,sheet1!$Q:$Q,0) may not be what's actually happening, hence the result not matching my expectations...
Here is a screen capture of the sheet I want to copy data from: This sheet is set up and controlled by another party. I CANNOT change data; I CANNOT change data format that is already entered (eg I can't change a col set to Date to Plain Text!) See red notes.
But I can convert Dates in col N to Plain Text in col Q. Column Q is what I am querying/comparing in the formula in the destination sheet (see second screen capture below)
Sheet1 capture: data to copy, criteria date col
In sheet5 I have this formula that queries sheet1:
=INDEX(sheet1!$A1:$O2002,MATCH($B$1,sheet1!$Q:$Q,0),0)
Here is a screenshot of what that formula produces in sheet5
Sheet5 capture: result of using formula
Notice, it kind of works...(when I just paste the formula into my starting cell... it found the one line with the criteria I set) but then if I drag B3 down to query sheet1 more... it just grabs everything, even if $Q:$Q doesn't match the criteria set in B1...
Why?
Any help or clarifying questions are appreciated. Thanks
when dragging you did not lock the rows with $
your formula:
=INDEX(Sheet1!$A1:$Q100, MATCH($B$1, Sheet1!$Q:$Q, 0), 0)
should be:
=INDEX(Sheet1!A$1:Q$100, MATCH($B$1, Sheet1!Q:Q, 0))
coz with your initial formula you just created sort of a "sliding range" by every drag-down. to understand the formula... you are indexing range A1:A100 (from row 1 to row 100) where you narrow it down to just 13th row (MATCH outputs row 13 coz there is the match found. next you drag down and indexing range changes to A2:A101 but the MATCH formula always outputs 13 so 13th row from range A2:A101 is row 14, etc.
anyway, use this in Sheet5!B3 after you delete everything in B3:B range:
=FILTER(Sheet1!A:P, Sheet1!N:N*1=B1*1)
I need to transpose parts of a table row by row. The following example illustrates what the result needs to look like:
I tried different combinations of arrayformula(), flatten() and transpose(), succeeded with getting the last column right with =arrayformula(FLATTEN(B4:C)), but need now help with fixing this.
Link to table
Try this in row 2 of the example screenshot:
={flatten({A2:A,A2:A}),arrayformula(flatten({if(A2:A<>"",B$1,),if(A2:A<>"",C$1,)})),flatten({B2:C})}
Or if you want the column headings, put this in row 1:
={"A","B","C";flatten({A2:A,A2:A}),arrayformula(flatten({if(A2:A<>"",B$1,),if(A2:A<>"",C$1,)})),flatten({B2:C})}
The new column 'C' ends up being a mixed data type, so be careful if you run a future query on these results as it doesn't like mixed data.
For local implementation (as per your initial screengrab, EU locale file), try this in cell E4 - since the formula sits in row 4, the array range needs to go from 4 (A4:A):
={flatten({A4:A\A4:A})\arrayformula(flatten({if(A4:A<>"";B$3;)\if(A4:A<>"";C$3;)}))\flatten({B4:C})}
Alternatively, if you want column headings, try this in cell E3 - the array range is still A4:A because "A"\"B"\"C"; puts headings in row 3, ; is a return, then the rest of the formula targets data from row 4 down:
={"A"\"B"\"C";flatten({A4:A\A4:A})\arrayformula(flatten({if(A4:A<>"";B$3;)\if(A4:A<>"";C$3;)}))\flatten({B4:C})}
If you want to limit the array range to a specific row rather than working down the entire sheet (eg. row 20), then A4:A would need to be A4:A20.
This is a basic SPLIT(FLATTEN( problem.
Arrayformula() can always exist on the outside of a formula and will apply to the whole thing.
This is on a new tab in your sample called MK.Help:
=ARRAYFORMULA(QUERY(TO_TEXT(SPLIT(FLATTEN(Data!A2:A&"|"&Data!B1:C1&"|"&Data!B2:C);"|";0;0));"where Col1<>''"))
I have 2 sheets which are connected.
Sheet-1: Has ID column and Status column (Status field is manually updated by the team)
Sheet-2: Has ID column and Status column (+ many other fields)
Requirement: Status column in Sheet 2 to be updated from Sheet-1 if ID column in sheet-2 = ID column in Sheet-1
I wrote a Query and ImportRange, but I could find Query working only when I compare it against a static value (for e.g. Yes). What I want is it to check against the value in ID column from both the sheets and import only for rows that match.
=QUERY(IMPORTRANGE("1ZkPaYb1IIIkcbVerdmZ-Ru1vxFu1YMWj74QNQj2jles", "Ops Action Sheet!B2:B10000"),"select Col2 where Col1 = 'Yes'")
This doesn't directly answer your question about using QUERY, but I believe that that function might not be the best tool for what you're trying to do.
I write below a solution using the alternative function VLOOKUP.
I am assuming here that by "Sheet-1" and "Sheet-2", you actually mean entirely different spreadsheets, judging by your use of IMPORTRANGE.
If you don't mind having a copy of Sheet-1's contents living within Sheet-2, here is what you can do:
On a new sheet (tab) in Sheet-2, copy this function (fill in sheet_1_url):
=IMPORTRANGE("sheet_1_url", "Ops Action Sheet!$A:$B")
You should see a copy of the data from Sheet-1 in that tab. You can hide this tab or protect it if you wish.
On your main data tab within Sheet-2, copy this formula in your Status column (assuming that your ID is in A2:
=IFERROR(VLOOKUP($A2,range_from_step_1,2,),)
Copy that formula down as much as you need.
However, if you don't want to have a copy of Sheet-1's data in Sheet-2 for whatever reason, you can simply skip steps 1-2 above, going straight to step 3, with the following formula in Sheet-2:
=IFERROR(VLOOKUP($A2,IMPORTRANGE("sheet_1_url", "Ops Action Sheet!$A:$B"),2,),)
Not that I recommend it, since you'd technically be importing your data virtually within the formula N number of times, which will be a huge performance hit.
You can see the references for the formulas used above here:
IMPORTRANGE
VLOOKUP
IFERROR
edit to reflect and paste in spreadsheet 2:
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, IMPORTRANGE("ID", "Sheet!A:C"), {2, 3}, 0)))
A2:A - column of IDs in spreadsheet 2
Sheet!A:C - column A of this range hosts IDs
{2, 3} - brings column B and C from spreadsheet 1 into spreadsheet 2
I'm trying to return the column headers for a row that is marked with an x. The row is selected from a name in the left column. I'm stuck here.
I can illustrate what I want to do by showing these images:
Start table
The result I want is this:
Outputs of the possibilities for the first sheet
I have put more information in my Example Sheet.
Link to editable example sheet
This formula should create a table (with a single formula) with the months in one column and the headers in the second column.
=ArrayFormula({A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)})
If you'd want to 'lookup' the months you manually type in you can wrap the above in a vlookup. Example:
=ArrayFormula(if(len(L4:L); vlookup(L4:L; {A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)}; 2; 0);))
You can check out both formulas in the copy of the sheet I've made in the spreadsheet you shared.