I'm trying to design an order form for uniform orders that allows the user to select an approved item of uniform from a drop down list, which in turn then allows them to choose the size of the garment in another drop down list.
However as the garments have different size ranges I would like this variable list to omit any blanks. =IF(Sheet2!$B$3=$E$1,E2,IF(Sheet2!$B$3=$F$1,F2,IF(Sheet2!$B$3=$G$1,G2,IF(Sheet2!$B$3=$H$1,H2,IF(Sheet2!$B$3=$I$1,I2,IF(Sheet2!$B$3=$J$1,J2,IF(Sheet2!$B$3=$K$1,K2,IF(Sheet2!$B$3=$L$1,L2,IF(Sheet2!$B$3=$M$1,M2,IF(Sheet2!$B$3=$N$1,N2,IF(Sheet2!$B$3=$O$1,O2,IF(Sheet2!$B$3=$P$1,P2,IF(Sheet2!$B$3=$Q$1,Q2,IF(Sheet2!$B$3=$D$1,D2,"ERROR"))))))))))))))
I have the above set to build the size list based on B3 in Sheet 2 being the cell used to select the garment type. Columns D-E being the different garments, and rows 2-14 being the sizes for each product. the same code is repeated 13 cells (the longest size range) with cells where the size isn't available set to show nothing. e.g.
=IF(Sheet2!$B$3=$E$1,E7,IF(Sheet2!$B$3=$F$1,F7,IF(Sheet2!$B$3=$G$1,"",IF(Sheet2!$B$3=$H$1,"",IF(Sheet2!$B$3=$I$1,"",IF(Sheet2!$B$3=$J$1,"",IF(Sheet2!$B$3=$K$1,"",IF(Sheet2!$B$3=$L$1,L7,IF(Sheet2!$B$3=$M$1,M7,IF(Sheet2!$B$3=$N$1,"",IF(Sheet2!$B$3=$O$1,O7,IF(Sheet2!$B$3=$P$1,P7,IF(Sheet2!$B$3=$Q$1,Q7,IF(Sheet2!$B$3=$D$1,D7,"ERROR"))))))))))))))
However even though the the cell displays blank, because the formula is still in the cell the "ignore blanks" checkbox doesn't filter them out.
Any ideas? Or have I just overcomplicated everything?
Related
I have two columns (Increment Rating & Promotion) where a user has to provide her input.
The "increment rating" input is restricted from Min (0.5) to Max (4.5) and the "Promotion" input is restricted to "Yes" or "No".
I know that for, Increment Rating I can apply the decimal validation criterion between Min & Max values, and for Promotion, I can apply the "list" criterion.
However, IF the user has entered the max value (i.e. 4.5) in the first column (i.e. Increment Rating), then Promotion must not be "Yes". It has to be either No or Blank (And I also need to show an error message saying that "This is not allowed"). On the other hand, IF the user is filling the second column (i.e. Promotion) before the first column and selects "Yes" as input then Increment Rating can not be more than Max-1 (i.e. 4.5-1=3.5) and need to show an error message here as well.
Is it possible with data validation custom formula? Or someone can help with #VBA.
Thanks.
You can create a table featuring the allowed data values for each input row and then refer to that table with relative references (i.e. no row fixing with $).
Here below is an example of such a table with formulas that adjust the allowed data values conditional on the input already provided. Note that the rows in the 'Source' section of the data validation window are not fixed.
Such that, when selecting the drop down window of those cells that have a list, you can see how the list is conditional on the table on the right.
If the input is done one cell after another (and not through copy and paste over both columns and once) an error message should not be needed since both columns have data validation restrictions conditional on one another.
You do not have to re-do the data validation for every row but simply select all input rows of one column and use relative reference instead of absolute reference in the 'Source' field of the data validation window.
I built a form in Excel which uses data validation to apply drop-down selections. The user selects from one category which creates a dependent list based on the selected category, and this extends to yet another selection. This is set up using a query and VBA as follows: Each dependent drop-down relies on the former by using code like =INDIRECT(A1) where A1 is the first selection and the next list is assigned to a Named Range using the title in A1.
Unfortunately, by the final list selection the number of named ranges seems to have exceeded Excel's capacity (>10k) and so instead I have referred to a fixed range which uses an INDEX MATCH function in each cell to present the options. The problem is that some versions of this final drop-down need 5 options and others need 150, so I have to set the final list to a static 150 cells to accommodate the largest possible data set.
Ignore blank cells does not work in the data validation due to the use of INDIRECT. Is there another way to make this system (or any other system) work for such a large data set?
As a note, I considered forcing the use of buttons [to adjust the named ranges] between selections but I don't believe that is a fit for this user base.
Ive got a spreadsheet which has 3 columns. These are name, age, value
I want to create an incell dropdown list based on unique values in the "name" column. There could be two cells in the "name" column with "John" in them for example. i.e. duplicates
When "John" is selected in a dropdown I want to create another dynamically created dropdown that shows only the age's for the entries. For example, if there were two rows with "John" in the name column then the other dropdown should show the age values for each of these only. Based on the two selections id like to show whatever's in the value column.
Do you think i need to use macros to achieve this?
To complicate matters the amount of rows in the list may change over time and therefore the blank names will need to be removed. The 'ignore blanks' when creating the incell dropdown does nothing and they are still shown in the list.
Any advice would be appreciated.
Based on your description I think you are creating list validated drop down cells. The lists can be subsets of an initial database. An example of such a database might look like:
With the validated drop downs adjacent like:
This can be achieved in a few steps.
1) Create a subset of all of the unique names in a helper column, I will do this in J.
=IFERROR(IF(NOT(INDEX($A$2:$A$20,MATCH(0,INDEX(COUNTIF($J$1:J1,$A$2:$A$20),0,0),0))=""),INDEX($A$2:$A$20,MATCH(0,INDEX(COUNTIF($J$1:J1,$A$2:$A$20),0,0),0)),NA()),"")
The range I am testing for uniques only extends to A20 but you could take this as far as you like.
2) Since you are doing this with validation lists that a user must select, you should probably alphabetize them. I do this in the next column over K.
=IFERROR(INDEX(INDIRECT("J1:J"&SUMPRODUCT(--(LEN(J:J)>0))+1),MATCH(ROWS($J$2:J2),COUNTIF(INDIRECT("J1:J"&SUMPRODUCT(--(LEN(J:J)>0))+1),"<="&INDIRECT("J1:J"&SUMPRODUCT(--(LEN(J:J)>0))+1)),0)),"")
This formula is an array formula and must be entered with ctrl+shift+enter for the first cell and then you can fill down. In a near by cell let's keep track of the complete range occupied by meaningful names used to make our alphabetized list (no blanks). Enter the following:
="K2:K"&SUMPRODUCT(--(LEN(J:J)>0))+1
Note that this is assuming my uniques are in column J. If you put them elsewhere you will need to modify this.
3) At this point we can make our first validated drop down. I'm using excel 2016 so I select the cell where I want the drop down (in my case E2) and then go to Data -> Validation. Under this I choose Allow: List; and Source: I enter the following:
=INDIRECT($K$1)
As K1 is the cell where I am keeping track of the range of useful and alphabetized uniques. Example:
Now back on the main sheet I have a drop down in E2 featuring that list. Next let's build the subset of useful ages.
4) In a new helper range (for me 'M2:M10') enter the following:
=IFERROR(SUM(LARGE(IF(($A$2:$A$20=$E$2)*ROW($A$2:$A$20),$B$2:$B$20,""),COUNTIF($A$2:$A$20,"="&$E$2)-ROW()+ROW($M$2))),"")
This is another array formula and must be submitted with ctrl+shift+enter, but in contrast the other array formula you must enter this for the whole range at once, I just selected a small number of cells because I know I won't have more than a few ages. If you suspect you will have more make this range large.
In the same fashion as the names lets track the range of useful ages in a nearby cell (I chose N1).
="M2:M"&COUNTIF((M:M),">0")+1
5) Make the next validated drop down. Select a cell (I picked F2) and again Data->Validation, choose a list and now use the age source:
=INDIRECT($N$1)
6) Getting the value that corresponds to the individual with that age is easy now. In the next cell over from enter:
=SUM(IF((A2:A20=E2)*(B2:B20=F2),C2:C20))
There you have it. An example of what my completed sheet looks like is here:
One last thing to mention. When you do this and toggle to a new name, it will not reset the age drop down automatically. So to make this appear reset, you can use some clever conditional formatting. I formatted F2 & G2 with the following rule and set the font color to white:
So while the value in each of those cells doesn't reset when a drop down with higher precedence is changed it appears to blank out forcing the user to pick a new age from that drop down.
Good luck!
I would like to find the nth value in a list that matches specific criteria and have those values printed in separate places in separate worksheets.
More specifically I have a list of invoice numbers either beginning with a number or with PF and I want the first (or second, third etc) value beginning with PF to show on the Proforma Invoice worksheet, and the first (or second, third etc) value beginning with a number to show on the Invoice worksheet.
At the moment I have a selection of invoice numbers like so:
Invoice #
PF17-0982
43256
65342
96038
PF16-0934
10293
And I would like to print the nth value on this list matching the criteria I give, so either beginning in a number or beginning in PF, in a separate worksheet.
Initially I tried
=IF(LEFT('Top Sheet'!S5)="P",'Top Sheet'!S5,"")
which works to find the number beginning with PF but obviously only for the first cell in the list.
I also have
=IF(ISNUMBER(LEFT('Top Sheet'!S5)*1),'Top Sheet'!S5,"")
Which again works wonderfully for the first value in the list but not for much else.
So, naturally, I googled and tried using INDEX and MATCH and SEARCH functions as found here https://exceljet.net/formula/get-first-match-cell-contains but I don't want the output to be another list dependant on only one of the values in the invoice number list. However I don't mind having an intermediate list (e.g. list of TRUE and FALSE values) which will ultimately lead to me having a single output. I have this list at the moment which was done using:
=SUMPRODUCT(--ISNUMBER(SEARCH({"PF"},'Top Sheet'!S5)))>0
And that brings me here, I've tried various variations of the above techniques and failed hopelessly. I either get an error of some description or just TRUE and FALSE values. I hope this makes sense.
Another formula approach, with which you can enter the formula normally, is to use the AGGREGATE function to determine the row number within the array of invoices. With the SMALL operator, you can work on an array, ignore errors, and return multiple values.
If Invoices is a named range containing your list of invoices, then:
For invoices starting with PF
=IFERROR(INDEX(Invoices,AGGREGATE(15,6, 1/(LEFT(Invoices,2)="PF")*ROW(Invoices)-MIN(ROW(Invoices))+1,ROWS($1:1))),"")
For invoices starting with a digit
=IFERROR(INDEX(Invoices,AGGREGATE(15,6,1/ISNUMBER(-LEFT(Invoices,1)*ROW(Invoices))*ROW(Invoices)-MIN(ROW(Invoices))+1,ROWS($1:1))),"")
For either of these formulas, enter in some cell and fill down until the formula returns blanks. The ROWS... argument will increment and return the appropriate k for the SMALL function.
Another method would be to use a simple Filter, then copy/paste the visible cells to where you want.
Or you could use the Advanced Filter, which has a built-in method to paste the results to another location.
In order to extract multiple items from a list you can use the INDEX function with SMALL to create an array formula.
=IFERROR(INDEX($B$4:$B$9,SMALL(IF((ISNUMBER($B$4:$B$9)),ROW($B$4:$B$9)-3),ROW(1:1)),1),"")
IMPORTANT: use CTRL+SHIFT+ENTER when entering this formula to make it an array formula.
This formula takes the first numeric value from your list. If the formula is changed to ROW(2:2) it would select the 2nd numeric value from the list and you can autofill the formula down to extract as many as you like.
It's quite a complicated formula to follow but you first index a range "INDEX(B4:B9" then use SMALL with an if statement "(ISNUMBER(B4:B9)". Then define the first row of the source data "ROW(B4:B9)-3)" the minus 3 is because it's 3 rows from the top. Next the row that matches your criteria that you want to extract "ROW(1:1)" and last the column that contains the value that you want "),1"
I'm not the best person to explain this formula but there are some good tutorials online.
PivotTable alternative:
(optional) select the range of cells including the header "Invoice #" cell
Insert tab > PivotTable
make sure the header cell is included in the Table/Range: field
select Existing Worksheet and the Location range where you want the filtered list
on the PivotTable Field List that shows up on the right check the Invoice # field
on the sheet, in the Row Labels cell click on the triangle filter button and select Label Filters > Begins With... > PF
(optional) in the Design tab click Grand Totals > Off for Rows and Columns, uncheck Column Headers, and rename the Row Labels cell text if needed
For the numbers, you can copy the PivotTable and change the Label Filter to Less Than... > A
Whenever the source Invoice # range changes, you can click Refresh All on the Data tab for the PivotTables to refresh.
i have a table in exel
column 1 = bolt sizes in imperial values
column 2 = bolt sizes in metric values
now a called the column 1 ''bolt_size'' and created a drop menu where you can choose between all the different possible sizes (in imperial) but as for the rest of the sheet i need the metric values.
what i have been tryinh to do is once the choice in selected in the drop menu, the second value (the metric one) appears in a chosen cell where the rest of the sheet will call that value for further calcuations.
I have sucessfully made that cell display 1 - 10 (when choosing from the drop menu) instead of the actual values associated with the bolts.
Please help guide me in the right direction
If this is a Form Control/ Combobox, and you have specified its Cell link, then it will display the index number of the selected item, rather than the actual value. In a cell enter the following formula that uses the linked-cell's value to retrieve the text from the input range:
=INDEX(C2:C4,D6)
C2:C4 is the Input range and D6 is the Cell link.
If you are not using a Form Control then you'll need to clarify your question.