Generate or fill cell data based on another dataset excel - excel

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.

Related

Large if, but need to match a name base on criteria

I have a table like this (Sheet2):
Where im gonna be adding next columns in the future.
The thing i want to do is, create a small table with TOP 10 users (Sheet1), base on the criteria which is date in cell B2.
Like that:
I've manage to retrieve TOP 10 scores based on criteria (cell B2)
=LARGE(IF(branch_units!$C$2:$O$2=$B$2,branch_units!$C$3:$D$48),D3)
But i really can't match names with the score.
Is it possible? Can someone try to explain it to me with an example? Thank You all.
You can use INDEX/MATCH like below
=INDEX(Branch_units!$B$3:$B$8,MATCH(F3,Branch_units!$C$3:$C$8,0))
If you want to select columns dynamically based on date then use below formula.
=INDEX(Branch_units!$B$3:$B$8,MATCH(F3,INDEX(Branch_units!$C$3:$G$8,,MATCH($B$2,Branch_units!$C$2:$G$2,0)),0))
So, when you change date on B2 cell, your score column will change and still you will get name for that changes.

Vlookup DragDown

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));"")

How to count unique column data in an excel sheet

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)

excel formula to return multiple results

I am currently using Index,Match to match records from one sheet to the other. Works great, except when I have multiple records with the same identifier. Let me explain:
The sheet named Open Leave Report contains the raw data (lookup values), while the sheet named Open Leave Capture contains the scrubbed data. So my formula looks like this
=INDEX('Open Leave Report'!O:O,MATCH('Open Leave Capture'!C9,'Open Leave Report'!B:B,0))
Works great, except when I have the following:
Column B Column O
Employee ID Continuous or Intermittent
1646484 Intermittent
1646484 Continuous
So when I type the Employee ID in the Open Leave Capture it always brings back the first row, but it ignores the second record. It looks like this:
Employee ID Type
1646484 Intermittent
1646484 Intermittent
Is there any way I can format my Index/Match formula to bring back both records?
I hope I explained this well
Don't use INDEX and MATCH for this...use PivotTables instead.
Whenever I want certain records from a list to appear in a different place, I turn my source data into an Excel Table, and make a PivotTable out of it, and then filter that PivotTable to show just the items I'm interested in.
No formulas, and as soon as you refresh the PivotTable it will automatically pick up any changes to your source data. Unlike formulas, which can be overwhelmingly complex to pick apart, and rely on you remembering to drag the formula down the page in order to ensure you capture any new data.
The solution is far simpler if you convert the source data into a table. Select the source data then use Insert > Table.
This solution has the following assumptions:
Source data has columns named "Employee ID" and "Type"
In the destination, the IDs to be looked up start from cell A2
In the destination, the values to be returned start from cell B2
This is formula to put into cell B2. This is an array formula. You need to double click into the cell, paste the formula, then save it by pressing CTRL+SHIFT+ENTER. You can then fill it down as far as you need to go.
=IFERROR(INDEX(Table1[Type],SMALL(IF(Table1[Employee ID]=A2,ROW(Table1[Employee ID])-ROW(Table1[[#Headers],[Employee ID]])),COUNTIF($A$2:A2,A2))),"Not that many")

How to automate a spreadsheet so that changing a value in one cell allows that entire row to appear in a separate tab of the worksheet?

Say I have a spreadsheet, as shown below:
Is there some kind of tool, add-in or formula, that would allow me to take all of the rows that are in 'July', and put them in a table in a separate tab:
In such a way that if I changed say 'COA' (the first row in the first picture) from January to July, it would automatically update the separate table to include this?
(Or at least be updateable with a click of a button or by refreshing)
My boss has asked me to see if this is possible, and I have no idea of how to go about it.
Thanks
It is possible.
In order to extract multiple items from a list you can use the INDEX function with SMALL to create an array formula.
Try the formula below. It assumes that the first column is A and column F contains the months.
=IFERROR(INDEX($A$2:$F$300,SMALL(IF(($F$2:$F$300="July"),ROW($A$2:$F$300)-1),ROW(1:1)),1),"")
IMPORTANT: use CTRL+SHIFT+ENTER when entering this formula to make it an array formula. You then need to auto fill down to get all the July records. This formula pulls data from column 1 (that's the last 1 in the formula). If your code in column 1 is unique to each row you can use a VLOOKUP to get the other columns. If it's not then you can copy the formula to the next column. And change the 1 at the end to 2..3 etc.
Instead of putting July in the formula you can reference a cell that contains July and then duplicate the sheet and change the cell to August or simply change the cell whenever you like to see data for different months.
It's not an easy formula to follow but it does work.
You could try doing a Pivot table with all the columns expect month in the rows section, using tabular view, no subtotals, and repeat item labels. Then put month in the filter section. Then you can update the pivot table by right click refresh or by clicking the refresh all on the data tab

Resources