I have a table with all sorts of data (description, specifics, price, ...) stored in tab2.
In tab1 i want to be able (for an unfixed amount of lines) to first select a value from column 1, this i've got figured out, and then based on this value populate the dropdownlist on column 2. But this is the problem atm, i can't get this to work for the life of me... There's not a single option giving me this possibility to perform this on 100's of lines benath eachother.
Can someone please help me.?
Thanks in advance
Hidde
I assumed how the data in tab2 may be structured, but it's a bit unclear.
I assumed that in column 1 there could be values that occur more than once and the different values in column 2 that are behind the value are to be part of the second drop down data list.
If you're using office 365 for the first data of your drop-down list:
=UNIQUE(FILTER(tab2!A:A,tab2!A:A<>""))
for data in your second drop-down list (if the first drop-down is in A1):
=UNIQUE(FILTER(tab2!B:B,tab2!B:B=A1))
For older version of Excel I have the following, which is not as neat as the solution above:
If your 1st drop-down in tab1 is in cell A2, type the following in B2:
=IFERROR(INDEX('tab2'!B:B,MATCH(0,IF($A$2='tab2'!A:A,COUNTIF($B$1:$B1,'tab2'!B:B),""),0)),"")
Enter as array with ctrl + shift + enter
Drag down the formula to get the unique values from tab2 column B that meet the chosen value in A2.
In you second drop-down (cell C3 for instance) type the following in the source for your drop-down list:
=OFFSET('tab1'!$B$2,,,COUNTA($B:$B),)
This will result in the desired data in your drop-down, however this also shows all blanks from how far you copied down your formula in column B in your drop-down list.
Also referencing to whole columns in this examples makes it way slow, so please narrow the ranges as much as possible.
I hope somebody else can show a cleaner/faster solution, but this is something.
Related
Im beginning a new job in a fabric. Actually, for each product, they have a excel file with the product operations in different sheets. I saw that a real problem, it takes a lot of time, and every time we should have to change the layout of the order, we are going to need to change a lot of excel files.. It will take forever and I think I can help on that.
So, my idea, is making a sheet with all the products and their operations and formulas:
Then, I have maked another sheet with the order fabrication with all the operations needed to make the product:
Every product will have an ID and im using in all cells the vlookup function from the ID:
=IFERROR(VLOOKUP($K$3;'estrutura-artigos2'!B8:V71;5;FALSE);"")
And Its Ok like you see on the last image, the problem is when I change the ID it doenst change like it should be (on my head):
Can anyone help me on this problem? I want it to change always to the ID I insert, and dont continue with the new ID.
=IFERROR(INDEX(Sheet1!E:E;MATCH(1;($K$3=Sheet1!$A:$A)*(COUNTIF($A$6:$A6;Sheet1!$E:$E)=0);0));"")
As your examples show no columns or rows I made my own. Please modify the formula to your ranges. Sheet1 is your datasheet.
Column A in Sheet1 is the column holding the ID in your datasheet.
Column E in Sheet1 is the column holding the 'op' in your datasheet (between qty and machine column).
Counting starts at row 6 in my example, but modify it to the cell above where you put your formula.
Enter the formula with ctrl+shift+enter as it is an array formula.
Change the index for the different results, but keep the rest of the formula unchanged.
Updated answer based on the visibility in rows and columns:
In A13 use =IFERROR(INDEX(datasheet!F$8:F$72;MATCH(1;($K$3=datasheet!$B$8:$B$72)*(COUNTIF($A$12:$A12;datasheet!$F$8:$F$72)=0);0));"")
Match returns the row number of the first match where datasheet column B equals the value in $K$3 and where the values of datasheet column F don't equal any of the previous results of this formula in column A (above the current row number)
The result is the row number that needs shown from the indexed column.
For the issue im having, this is as far I already went thanks to #P.b:
The problem im having is that the formula Im using goes right no operation 20, instead going to the operation 1, any idea how to fix this?
Formula using on the A13 = =IFERROR(INDEX(datasheet!F:F;MATCH(1;($K$3=datasheet!$B:$B)*(COUNTIF(datasheet!$B$8:$B71;datasheet!$F:$F)=0);0));"")
I am using excel sheet and i have data column as shown below:
As we can see that some of the names are duplicate or appeared twice. My question is how can count unique name records or rows associated with each name for summary column.
Out put i am looking for is shown below:
Not sure which formula to use as count is counting all of that data i.e. '7' in this case. How can i use count or any other function to count unique records as shown above?
You can do what you're after with a pivot table.
Click the Insert tab then select "Recommended Pivot Tables".
A window will open up prompting you to select the data range. I recommend using a named range for your list and referencing that, but you can just highlight the list directly if you want.
Once the data range is selected, click "Ok" and new window will open with exactly what you want. A unique values list and a "Count of Column1". It is the default of the recommended pivot tables.
I outlined this because it's easy and fast, but it's important to understand you can make this pivot table yourself from scratch if you learn about pivot tables in general. Pivot tables are often overlooked in Excel as an option.
Lastly, you could get really advanced with Excel Power Queries. Just Google "Excel Power query" and you will be shown all kinds of information on them. They are a close second place in power to manipulate Excel data short of using VBA.
Good luck!
CountA(Unique(D2:D8,,False)) = 5 [Count(Unique(D2:D8)) is the same as False is the default.]
CountA(Unique(D2:D8,,True)) = 3 (once and only once)
Note: the Unique function was released in late 2019 to Office 365. So if you want to use this check your version, not present in 1908, present in 2006.
Edit: It's actually in 2002, I just updated my 1908 machine.
HTH
If names duplicates are removed the following formula can be used: =COUNTIF(B:B,F2)
If duplicates must be removed by formula, MATCH (searches for a specified item in a range of cells, and then returns the relative position of that item in the range.) and SMALL (Returns the k-th smallest value in a data set.) functions can be used as shown.
C$1048576 is used to reference last row number for a big list case.
formulas:
Column A, names sequence
Colunm B, names
Column C, formula =MATCH(B2,B:B,0)
Column D, formula =IF(COUNTIF(C2:$C$1048576,C2)=1,C2,"")
Column E, formula =SMALL(D:D,A2)
Column F, formula =VLOOKUP(E2,A:B,2,0)
Column G, formula =COUNTIF(B:B,F2)
For anyone like me without O265's lovely Unique & Filter Functions, and who doesnt want to use a pivot table, and there are many ways to do this, but this i have just done this in normal excel.
List of data in Column H, Formula in column O3. Drag down. Highlights your distinct and unique values from H.
=IF(COUNTIF(H:H,H28)=1,"U - "&COUNTIF(H:H,H28),IF(COUNTIF(H$1:H27,H28)=1,"U - "&COUNTIF(H:H,H28),"-"))
Formula is short. You can just do this and drag down. Apply the same principal to your worksheet data wherever it is.
=IF(COUNTIF(H:H,H3)=1,"U",IF(COUNTIF(H$1:H2,H3)=1,"U","-"))
Similarly, you can just use this formula here (credit goes to this source for this one):
=(COUNTIF($H$1:$H1,$H1)=1)+0
Id like to point out that the above formula is a better formula than mine. It highlights with a "1" (or with a tweak, the value of your choice) the first time any value is seen/spotted on any given list, whether duplicate or unique.
Whereas mine is a bit "more random" when picking up the "unique and distict" values.
Mine gets there in the end, but Extend Office's gets there first, as I think is proper (getting the first time a unqique distict value is spotted/occurs.).
Formula in K5 =IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","") and drag down...
You could append/add a normal basic countif after the results to show how many actual times the given value appears if you wanted. :
=IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","")&" - "&COUNTIF(H:H,H5)
I am trying to condense data in a specific way. I want any occurrences of the number 1 in each column to show up as 1 (regardless of how many times it occurs) with the corresponding site, in the corresponding column. Some sites occur multiple times in the original data, and I want to make it so that only one of each unique site shows up in the resulting data table with a 1 for the corresponding column if there any 1's in the column from the original data.
I would think it would be a vlookup function, but I have tried many different things and I am really stuck on this.
Image of original data and what I am trying to do:
Thank you
This assumes that your data set only contains 1 or blank and this approach uses a Pivot Table with MAX function. Below are details in case anyone doesn't know Pivot Tables.
Select a cell in your data and insert Pivot Table. Note, I added a title for column A, as you need that in the Pivot Table.
Click in the created Pivot Table and the PivotTable Fields dialog should pop up. If not, right click in Pivot Table and select Show Field List.
Drag the Field names (Code, a, b,& c) down to the appropriate blocks below. (Values under Columns will be created for you.)
Click on the drop down arrow next to each field name and select Max. That will rename it to "Max of ...". If that bothers you, then you can type the name you want into the Custom Name field. Note, it will not let you type the same name as the field name, eg a, but it will work if you put a space in front of it.
Given that the Pivot Table would be a lot of work for a large number of columns, here is a formula based approach. Put this formula in cell G2, then drag it down and across to fill your new table.
Note, you will have to populate all codes that you have in column F. And if any new codes are added later you will have to keep this updated. One of the advantages of a Pivot Table is that it will do this for you.
I know that you won't be putting this in these cells, so adjust accordingly. In fact, I would recommend this be in another sheet.
=IF(COUNTIFS($A:$A,$F2,B:B,1)>0,1,0)
COUNTIFS($A:$A,$F2,B:B,1)
This will count each occurrence when the value in column A matches your code $F2 AND the value in column B equals 1.
If that count is >0, then you know that at least one match was found and the IF will return 1, otherwise 0.
I've a data set that shows;
employee name
date
time work started
time work ended
Now I am trying to have a report like sheet where I can select a certain employee name from a list of employees to view his/her time attended for a particular month.
I tried vlookup but went no where since I need to lookup by two columns plus a row.
Is this possible? without macros or vba.
Thanks
Since name and date are unique identifiers it is possible to use the sumifs function.
For ‘time in’ and ‘Rachel’ this will look as follows:
=Sumifs(column ‘time in’ from data set, column ‘name’ from dataset, “Rachel”, column ‘date’ from data set, “10/01/2017”)
Where Rachel and the date also can be a referenced cell.
=AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1)
The above formula will grab the row number that matches your criteria. to pull the information you want, you can place the row number inside an INDEX formula to get the following:
=INDEX(SHEET1!$D:$E,AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1),COLUMN(A1))
You can place the above in your first Time cell and copy right and down. You will see errors if criteria do not exist. ie no person of that name or no date data for that person. to avoid this you can wrap the whole thing in an IFERROR like the below:
=IFERROR(INDEX(SHEET1!$D:$E,AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1),COLUMN(A1)),"Nothing found")
if you would rather a blank than nothing found display change the "nothing found" to "" or 0 if you want 0 to be displayed.
Note: Aggregate is performing array like calculations in this case. As such you do not want to full column references as it will cause a lot of unnecessary calculations to be performed. Because you have unique entries, SUMIFS option given in another answer is a much better choice.
I think a pivot table will do the job for you.
Place the employee name in the filter, place date and
times in the rows.
Remove subtotals from the Pivot Table
Change Table layout to tabular and Repeat rows
Right click on the Time In and select Ungroup
Then you have the image below.
I have the following layout:
In B11 write this formula and drag down:
=INDEX($B$2:$E$5,MATCH($B$7&$A11,$B$2:$B$5&$C$2:$C$5,0),3)
In C11 write this and drag down:
=INDEX($B$2:$E$5,MATCH($B$7&$A11,$B$2:$B$5&$C$2:$C$5,0),4)
Note that these are Array-Formulas, so you need to enter them with CTRL + SHIFT + ENTER instead of the normal Enter.
You will get a #NV error if the employee hasn't worked on one of the dates A11 and A12. So you could surround the Formula with IFERROR to avoid this.
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!