I have 2 different worksheets like these
I need to have a new summary sheet with the Time spent sum.
Here should be the output:
What is the best way to implement the formula?
I've simulated your situation, creating two tables, one in sheet1, one in sheet2, containing information in cells B3:C5, and I came up with this formula:
=SUM(VLOOKUP(B3;Sheet1!$B$3:$C$5;2);VLOOKUP(B3;Sheet2!$B$3:$C$5;2))
You might get this to work in your situation by creating an extra column, where you concatenate first name and last name (in order to get the VLookup() to work), but I sincerely think there should be easier ways to get this done.
For your information, my table looks as follows:
A B C
1
2 Name Number
3 a X
4 b Y
5 c Z
The mentioned formula gave the sum of the Xs, Ys and Zs.
Lets say i have two sheets:
Sheet 1:
Sheet 2:
In my opinion the easiest way is:
Select the cell you want to paste the results
Go to Data - Data Tools - Consolidate
Press the arrow at Reference: select the first range, press enter and press Add. Do the same for the second range.
Select Left column and press OK
Structure:
Related
So I'm going to eventually have 3 sheets. Sheet 1 is where I have data (numbers for a category and a name associated with it. Sheet 2 is where I pull the top 5 users for each category. Sheet 3 is where I have a leaderboard for points gained.
Right now I'm trying to work with Sheet 2 (grab the top 5 performers from each category. I'm fairly new to Excel, but after some research it seemed that XLOOKUP would be the way to go. (i'll attach screenshots below.
I'm using this formula:
=XLOOKUP(LARGE('Cases Test for Categories'!$C$18:$C$55,1),'Cases Test for Categories'!$C$18:$C$55,'Cases Test for Categories'!$A$18:$A$55)
however when using it I get all 0's.
Here's a screenshot of values I'm trying to grab from "Warranty Service Request"
and here is a screenshot when applying my formula
The solution I would want is to grab the 5 largest numbers from sheet 1 with the person name as well.
I don't think that XLOOKUP can get you anywhere near what you want but the formula below will get you one step closer.
=INDEX(List,MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0),1)
In fact, it's the explanation of that formula which will be of help. Here we go.
List is a named range, perhaps equal to your 'Cases Test for Categories'!$C$18:$C$55. The reason for using a name is obvious. It's shorter. In my test List = A2:B6, in case you want to reconstruct it. Column 1 has names, column 2 numbers.
The term INDEX(List,,2) specifies the second column of List. You can replace the '2' with a formula to specify different columns of the named range.
In fact, INDEX(List,,1) does specify the first column and INDEX(List,4,1) specifies the 4th cell in that column, and that is exactly what you see in my formula. All of MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0) just serves to find the row number in List, in this example the number 4.
Of course, LARGE(INDEX(List, ,2),1) returns the largest number in column2 of List. The '1' can be replaced by a formula, for example ROW()-1 which would return 1 if placed in row 2 and count up from there as it's copied down. Try =ROW()-1 in any cell in row 2 and copy the formula down.
MATCH([LARGEST],INDEX(List,,2),0) returns the row number where the largest was found, and that is the number we need to return the name from the first column of List.
This will work perfectly for one column and can easily be modified to work for different columns. Your question doesn't specify how you would like to arrange the 5 results from each category but the formula can be modified a little to accommodate whatever you want. What it can not do is to deal with ties. MATCH(LARGE can only find the first of several identical results.
To break ties in this sort of operation is complicated and must be done ether by helper columns in the data table or using VBA. It's definitely the topic of another question. For now I hope that it's a problem you will not have to anticipate.
I have two excel files that I need to cross reference amounts in.
The first sheet looks like the below:
what I need to do is find any amount that are contained on sheet 2 and the month they fall into.
Sheet 2 looks like below:
for example on sheet 1 I have 56.49 in column C for reference AK1080117 in column A and this shows as Person 8 on sheet 2.
I can see this is correct as on sheet one it has a transaction date of 08-jan and on sheet 2 is in the column JAN.
There is no same ref that can be used between sheet 1 and 2 as sheet 1 has Reference and sheet 2 has Name.
Can anyone advise the best way to do this.
The complete sheets are hundreds of lines long.
Many thanks,
Note: Make sure your data has unique values AND it is not exceding the year 2017
If so, I have found a way to maybe do this in a few steps:
1: Add another column E to your first sheet and add this formula to second row of the column and drag it all the way down:
=SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1","")
2: Now create another column F next to the freshly made one and put this formula in second row:
=MATCH(C2;INDIRECT("Sheet2!"&E2&":"&E2);0)
3: Now create a third column G and put this formula in second row to be dragged down:
=INDEX(Sheet2!A1:D15;F2;1)
4: Now you have created a cross-reference because column G will show you the person with a match.
Edit: You can combine the three formulas direclty obviously but my personal preference is to brake things down to make them easier to understand :)
=INDEX(Sheet2!A1:D15;MATCH(C2;INDIRECT("Sheet2!"&SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1","")&":"&SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1",""));0);1)
Good luck with it!
You need a third table that has Reference and Name. Then you can use lookup functions or table relationships to link the data together.
Ask the source of the first table to include Name as a field.
Following data structure:
ID CRIT1 CRIT2
1 L M
2 H M
3 H H
I would like to get the IDs with Crit1= H and Crit2=H.
In a second sheet I want to build a table with the IDs which satisfy my criteria. So in this case only 3.
I tried with INDEX/MATCH and COUNTIF.
However, so far no useful solution based on strings and ranges.
I suggest a PivotTable without Totals or Subtotals, in Tabular Form, all three columns as ROWS and filtered to select H for each of CRIT1 and CRIT2:
Here is a formula solution That will create your table without any blanks.
This assumes your source data are in Sheet1. Edit as necessary.
=IFERROR(INDEX(Sheet1!A$2:A$9999,SMALL(IF((Sheet1!B$2:B$9999="H")*(Sheet1!C$2:C$9999="H"),ROW(Sheet1!A$2:A$9999),9E+99),ROW(1:1))-1),"")
This is an array formula and must be confirmed with Ctrl+Shift+Enter.
Now copy downard as far as needed.
Note: adjust the 9999s to a row number suitable to your situation.
Without macros you can only copy the single cells if the criteria are satisfied, and don't copy them if not. Paste this formula in A2, then copy it to right (other columns), and to bottom (other rows):
=IF(AND(Sheet1!$B2="H";Sheet1!$C2="H");Sheet1!A2;"")
Ok so the pivot table does work yes, however I want to plot a graph which seems to be impossible with pivot data model
Regarding the formula solution I don't think it works.
It will give me all IDs with either crit1=h or crit2=h
I want to populate some cells given certain condition. The thing is, I have no idea how to do this with just formulas (can’t use macros or the sort).
Anyways, here’s my workbook, with its **sheets**:
**Sheet1**
TASK Week
Test 1
Test2 1
Test3 1
Test4 2
Test5 3
Test6 2
Test7
**Sheet2**
Week
2
TASK
Test4
Test6
What I’ve been trying to do is:
Populate Sheet2 tasks based on the week chosen.
If I choose week #2 (in Sheet2), it should populate the task list (on the same sheet) with the tasks from Sheet1 that have that week number.
For example, right now it is (hypothetically) already loading tasks with a week == 2.
Any doubt, just let me know! I hope I made my issue clear.
Thank you very much in advance!
Okay, I found a better solution. This one requires an extra helper column on Sheet2, but it at least returns a compact list of matches (no weird spacing).
On Sheet2, in the first row of your list of matches (A3 in this example) enter the following:
=IFERROR(INDEX(Sheet1!$A$1:$A$7,B3),"")
In the adjacent cell in the next column (B3 here) enter the following:
=IFERROR(MATCH(2,Sheet1!$B$1:$B$7,0),"")
where 2 is the week # you are matching.
In the next row enter the following formulas (in A4 and B4 respectively):
=IFERROR(INDEX(OFFSET(Sheet1!$A$1:$A$7,SUM(B$3:B3),0),B4),"")
and
=IFERROR(MATCH(2,OFFSET(Sheet1!$B$1:$B$7,SUM(B$3:B3),0),0),"")
You can fill down this row of formulas as far as you like.
Here's the first way to do this I thought of. There are probably better, more elegant solutions, but I thought I'd share.
If you know the total number of tasks in your list on Sheet1, say n, you can do the following:
On Sheet 2 where you want your list of matching tasks, select from A4 (or whatever you want the top of your list to be) down to A(4+n-1). So for your sample data, select A4:A10
Without changing the selection, type the following formula:
=IF(Sheet1!B2:B8=2,Sheet1!A2:A8,"")
where 2 is the week # you want to match.
Enter the formula by pressing Ctrl+Shift+Enter.
I have two columns, the first column will have the name of a object, the second is who it belongs to. I want a new sheet for each person to list what they had assigned to them. here is a example:
dog F
cat F
bell S
whistle
bird F
So Fred has a dog, cat, and a bird; Scott has a bell; and no one has a whistle on their page. Now doing a simple IF() i can get it to look like this for Fred's page
TOP OF ROW
dog
cat
bird
And Scott's page will look like
TOP OF ROW
bell
however I want Fred's to look like
TOP OF ROW
dog
cat
bird
and Scott to be the same.
My current train of thought is to use =VLOOKUP($C$1,Items!A2:C1000,3) in a hidden column in D to tell me which row my data is in, (where Column C on Items is a hidden column with the row number of the row and C1 is the search parameter (S or F)), then =IFERROR(CELL("contents",INDIRECT(ADDRESS($D2,2,1,TRUE,"Items"))),"") , however I other than changing my row index of my search array to 1+ the last found item (which i have not figured out how to do) I can not figure out how to continue searching for the next item.
I know C++ and C# but never have coded in VBA before and I rely heavily on the MSDN and to my knowelge there is no MSDN section dedicated to the Excel API.
One way of achieving the list that you are looking for without any VBA code is to make use of the advanced filter.
On sheet 1 the input list is entered as follows
on sheet2 enter the filter criteria (this criteria means contains F in Owned by column)
and finally on sheet3, call the advanced filter function like this
make sure to select copy to another location
select the sheet1 input list as the list range
select the sheet2 filter criteria as the criteria range
and select somewhere in sheet3 as the output range (the copy to entry)
If you prefer to go down the route of excel VBA programming a good first step is to try out the macro recorder in excel (tools - macros - record macro)
good luck!
There is a good way of doing this with functions in excel.
Essentially you need to create a running countif
So in C2 you would have =COUNTIF($B$2:$B2,"F") Obviously the "F" could also be a reference to another cell. If you fill this formula down the range it will expand the range. Eg. in C3 it will say =COUNTIF($B$2:$B3,"F")
This will give you a running total in column C in your example this would mean:
dog F 1
cat F 2
bell S 2
whistle 2
bird F 3
The fact that you have 3 2s doesn't matter because a vlookup will always match to the first match it finds.
This technique has a lot of different applications. And depending on the data you may find it easier to put this on the left of the data so the VLOOKUP will be easier.