I have a drop-down list which change depending on another cell so if the other cell is set to no my other cell should have in a data validation range only stand-by if it's set to yes it should then have: real,phone,both everything works but...
my problem is that now I want to have a hundred others row in my array so I tried to extend the array but the data validation doesn't update. So I'd have to manually change one-by-one every data-validation cell.
Here is my sheet in the picture:
https://imgur.com/a/56Nk1SG (I've put a description on each image to make it more understandable).
notice: I know that in excel if I extend the array the data-validation works so I tried to extend it save it and then import it to google-sheets but it didn't work...and in excel there is no checkbox and some formula doesn't work so I've to keep it in google-sheets
edit: I know there is another post similar but it's not the same problem...
In my opinion the best way to achieve that is via VBA.
Steps:
Import "Yes" options in Range("A1:A4"). Range("A1") includes Yes as a header.
Select Range("A1:A4").
Home - Styles Tab - Format as Table - Select Light - Check range & Check "My table has headers".
Select "Yes" table - Design - Table Name: tblYes.
Import "No" options in Range("B1:B2"). Range("B1") includes No as a header.
Select Range("B1:B2").
Home - Styles Tab - Format as Table - Select Light - Check range & Check "My table has headers".
Select "No" table - Design - Table Name: tblNo.
Open VBA Editor. (Press ALT an then F11).
Double click on the sheet you want conditional formatting (from the box on the left up part of the page).
Select Worksheet from the left box above the code box.
Select Change from the right box above the code box.
Insert the below code and try.
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With ThisWorkbook.Worksheets("Sheet1") '<- Change sheet name if needed
If Not Intersect(Target, .Range("E1:E10")) Is Nothing And Target.Count = 1 Then '<- Change range if needed. Check if the change included in our range.
Application.EnableEvents = False
If Target.Value = "Yes" Or Target.Value = "No" Then '<- Case sensitive. Check the value insert if it is Yes or No
With .Cells(Target.Row, "F").Validation
.Delete '<- Clear previous valitation
If Target.Value = "Yes" Then '<- Check if the answer if Yes
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(""tblYes[Yes]"")"
ElseIf Target.Value = "No" Then '<- Check if the answer if No
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(""tblNo[No]"")"
End If
End With
Else '<- If the value insert is NOT Yes or No
.Cells(Target.Row, "F").Clear '<- Clear format & contents next to change cell
MsgBox "Insert Yes or No!" '<- Message box prompt for Yes or No
End If
Application.EnableEvents = True
End If
End With
End Sub
Sheet image including tblYes & tblNo:
VBA Editor image:
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
This is my first go at creating something in Apps Script for Google Sheets and I'm a bit stuck/overwhelmed. In the reading I've done I think what I'm attempting is rather basic. I'm just not getting to the solution, so I need a nudge...
Need:
I have a sheet that is tracking equipment that is checked out and returned to a central area.
The sheet has multiple pages with identical layouts.
On each page I have one column where (3) different options can be chosen from a dropdown list.
IN, OUT, and UNAVAILABLE
For each of the (3) entry options, I would like a popup message to appear when the entry is changed.
So in the range of F2:F100, if the entry is changed to "OUT" from "IN" I would like a pop-up to appear with a message of "Clear all fields to the right." and an "OK" button.
I have found a lot of examples to make a pop up when ANY field is changed, or when a sheet is opened. I'm stuck on limiting these pop-ups to only select fields/ranges/pages
Thank you all for the help.
SOLUTION
You can refer to this sample script below that runs via onEdit trigger, where the pop-up message will only run if any selected cell is under column F & if that cell's value was changed to "OUT" on any sheet on a spreadsheet file:
function onEdit() {
var ss = SpreadsheetApp.getActive();
//Check if selected cell is in column F (or col #6) was changed to "OUT"
if(ss.getActiveCell().getColumn() == 6 & ss.getRange(ss.getActiveCell().getA1Notation()).getValue() == "OUT"){
SpreadsheetApp.getUi().alert('Clear all fields to the right.');
}
}
If ever you need to add more conditions like if you only want to run the script to a specific sheet name, you can add ss.getSheetName() == '[Name of the sheet]' on the if condition separated by & sign, as seen on the sample below:
if(ss.getSheetName() == 'Sheet2' & ss.getActiveCell().getColumn() == 6 & ss.getRange(ss.getActiveCell().getA1Notation()).getValue() == "OUT"){
SpreadsheetApp.getUi().alert('Clear all fields to the right.');
}
Sample Result:
If a selected cell on col F is changed from IN to OUT via a drop-down option:
A pop-up message "Clear all fields to the right." will show on the sheet
I am trying to customize the columnsMenuTab display in ag-grid to hide certain group header rows from being shown. We have a column group hierarchy that looks something like:
Name
Type Name
Formula
Column Name
We'd like to hide the Formulas from being displayed inside the columnsMenuTab so that when the user is toggling the column visibility they don't see the formulas but they can still see the column name. The end result would be something like:
Name
Type Name
Column Name
Looking through the documentation (https://www.ag-grid.com/javascript-grid-column-menu/) I was not able to find a way to achieve this customization.
We are using ag-grid-react (enterprise) 21.0.1
Thanks.
05/18 Edit: Added some clarification as to the end result.
You can use suppressColumnsToolPanel: true for the column you dont want to show up in columnsMenuTab as well as the tool panel that shows up on the right.
This works for column or column group in the hierarchy and should work for Formula column in your case.
As per docs-
suppressColumnsToolPanel Set to true if you do not want this column or group to appear in the Columns Tool Panel. Default: false
Still works in #ag-grid-community/core#^28.1.1 #ag-grid-enterprise/column-tool-panel#^28.1.1
I set suppressColumnsToolPanel: true on one of the columns and this column does not appear in the column menu > column selection tab anymore.
I have an table in an MS Excel 2010. The table has two columns. The first column is a name of a person (Col A), the second column is the marks that the person secured in an exam (Col B).
I am applying conditional formatting. If I choose the following wizard
Home > Conditional Formatting > Format all cells based on their values
I can color the Col B on a 3-color scale. This is exactly what I want. However, I want it for the entire row and not only the cell in Col B. I want the name also to be formatted in the same color as the marks.
Anyone knows how to do this?
I have already looked around a bit. The following came close to did not solve the particular problem that I am trying to.
http://www.howtogeek.com/howto/45670/how-to-highlight-a-row-in-excel-using-conditional-formatting/
Conditional Formatting Rows Based on Date
You're probably going to have to use VBA code for this.
Right click the worksheet label and select 'View Code'
Inside the code window, paste in the following code:
Sub RunMe()
Dim xRng As Range, xCell As Range
With Me
Set xRng = .Range(.Cells(2, 2), .Cells(.Rows.Count, 2).End(xlUp))
' Change the first '2' above to reflect the starting row of your data
For Each xCell In xRng
xCell.Offset(0, -1).Interior.Color = xCell.DisplayFormat.Interior.Color
Next xCell
End With
End Sub
Now every time you run the macro (Alt-F8, select macro), column A will be formatted with the conditional formatting assigned to column B.
If you want this process to be automatic, change:
Sub RunMe()
to something like:
Private Sub Worksheet_Activate()
' This will run the macro whenever the worksheet is selected
or you could assign the code to a keyboard shortcut or a command button etc.
If you would like the code to run every time the file is opened, saved closed etc, add the code instead to the ThisWorkbook code window (although you'd have to alter the code slightly as 'Me' is referencing the particular worksheet in which the code is placed).
I have a formula in Google spreadsheet from cell B2 all teh way to B100 which is
B2=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(1:1)),0), "")
B3=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(2:2)),0), "")
B4=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(3:3)),0), "")
B5=iferror(INDEX(DB!$B:$AC,SMALL(IF(DB!$B:$AC=$A$1,ROW(DB!$B:$AC)),ROW(4:4)),0), "")
..
...
......
So it is pulling up values from a second tab which is named as "DB".
The Index row formula looks for the status "Completed" ( which is on cell A1) and return the details for all completed from the DB.
Google spreadsheet
main spreadsheet
Database in tab 2 (DB)
DB
The formula works fine , however i am getting duplicates of every cell which got the status "Completed "
Attached links to the screen shots for your reference.
Don't know what i am missing. 0_o
Thanks
I think you can use QUERY() for what you try to achieve.
Have a look at this example sheet and check sheet 2 where this formula is used to filter the data from sheet 1:
=query(Sheet1!A:H, "select * where B = '"&A1&"' ")
(where A1 is a drop down list with the values 'COMPLETED', 'in progress', 'resolving').
See if that helps ?
there is no need for formula here.
This is simply done by filtering:
Supposing you have a DB sheet like this
In your main sheet, put DB!A1 in cell A1, and drag and fill horizontally and vertically, to copy exactly your DB sheet into main sheet (you can do this selectively as well, there is no need to copy every column, just cpy those you want). Then click on FILTER, you can find it in SORT AND FILTER, then you will see a dropdown menu on all of the column headers. Simply by clicking on your status header, you can selected completed and press OK, it will ONLY show rows with completed on their status column.
And here is the link to download this example sheet
your links don't work for me.
You should use the FILTER() function, that is designed exactly for this purpose:
in cell A2 on your second sheet use: =filter('DB'!B:AC,'DB'!B:B=$A$1)
As suggested I would use Data validation with dropdown list, so that only valid statuses may be chosen.