Formulas to populate spreadsheet with data - excel

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.

Related

Sum items from different sheets Excel

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:

Counting unique numbers of tasks, when another cell range contains a random amount of dates

We have a spreadsheet that has many columns, however I'm needing help with developing a formula that encompasses only two of those columns. The sheet itself is setup like this:
Date Task
6/1/18 Row
6/1/18 Spot
6/1/18 Row
6/2/18 Spot
6/2/18 Spot
6/3/18 Row
6/3/18 Row
6/3/18 Row
6/3/18 Spot
...etc
Based on the above values, I am trying to figure out how many times Row appears in the "Task" list, however only counting it for unique dates. So on 6/1 we had Row twice, however it should only count as once, since we only spent one day doing the Row task. On 6/2, Row is not there at all, so our total amount of days doing the Row task is still at 1. On 6/3, Row was done 3 different times, however it should only count as one day, bringing the total amount of days we have worked on Row to 2.
Likewise, if we were to calculate for "Spot" then the total number of days worked on "Spot" would be 3. (This would be a separate cell value, but same premise, therefore same formula.)
I don't have the slightest idea how to get this formula even started. I know quite a bit about Excel, however my knowledge does not cover this specific issue, and I am not sure where to even start.
Any help would be greatly appreciated!
This is my bookmark for counting unique rows with a criteria: link
The formula that will work for you is:
=SUM(--(FREQUENCY(IF($B$2:$B$10=D1,MATCH($A$2:$A$10,$A$2:$A$10,0)),ROW($A$2:$A$10)-ROW($A$2)+1)>0))
This is an array formula and will need to be entered with Ctrl+Shift+Enter while still in the formula bar.
Here's one solution:
Column A and B are your columns
Cell C1 in C column (and all else): =A2&B2
D1 is simply 1
D2 cell is (drag that formula down also): =IF(COUNTIF($C$1:$C1, C2)>0, 0, 1)
H1 cell is: =SUMIF($B$1:$B$200, G1, $D$1:$D$200)
G1 is "Row"
Hope it helps!

amounts and ageing in excel

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.

Compute subtotal rows in a spreadsheet

I have a spreadsheet that looks like this:
A B C
1 Section Task Dev Hours
2 4 PROJECT TOTAL =c3+....
3 4.1 Public site =c4+c5+...
4 4.1.1 User Accounts 2
5 4.1.2 Daily Deal =sum(c6:c7)
6 4.1.2.1 Model 4
7 4.1.2.2 View 2
What I'd like is a better way to compute subtotals in column C for non-leaf rows. Using =sum is error-prone as I add/remove rows. Also I can only use it when all children are leaves, or it will double-count things. Using addition is even more error-prone and extra annoying. Is there some way to tell {Excel,OpenOffice,LibreOffice,Google Documents} to roll up the values in column C for all following child rows, based on the outline numbers in column A? I would love a function like this:
=sum_children(A2)
Where A2 is the cell with the current row's outline number.
You can use an array formula to do this. For the formula below, I've assumed that your Section values are sorted as you have shown above. In C2, paste the following and enter the formula by pressing Ctrl+Shift+Enter:
=SUM(IF(LEFT($A3:$A$7,LEN(A2))=A2,IF(ISERROR(FIND(".",$A3:$A$7,LEN(A2)+2)),$C3:$C$7,0),0))
You should then be able to copy cell C2 and paste onto any of the cells below that represent a parent section.
Basically this formula checks Column A below the current row for strings that start with the current section and only sums the dev hours for those that don't have an additional period after the current section + "."
To avoid having to update these formulas when you add additional sections to your table, you can make the endpoints of the arrays (A7 and C7 in the example formula) a row way beyond the bottom of your table (e.g. A50 and C50). This could affect performance slightly, but really only if you go overboard and give yourself a 50,000 row pad.

Creating a sublist based on a second column in excel

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.

Resources