I am seeking a formula to replace my current method of adding another vlookup to my formula string each time another week passes (the current formulas in the cells in column D). i.e - I would like it to look through my header row (Row 2) for the referenced weeks and find each one of them in my lookup table (FTE_Lookup) to sum all of the corresponding possible hours for those weeks. I read a couple threads on Sumproduct for multiple vlookups, but it doesn't quite match my situation. Below is a a link to my dummied-down spreadsheet for an example. The data in Row 2; Column D; and the FTE_Lookup table are of interest to this problem:
https://drive.google.com/a/vt.edu/file/d/0B7LOhGW3xbKgbGUxS2x1anNfV00/view?usp=sharing
Thank you in advance.
You will need to split the lookup named range to its two columns. I used FTE_Lookup_1 for the date column and FTE_Lookup_2 for the return value column
Then use this array formula:
=E4/SUM(IF((MOD(COLUMN($E$2:$FG$2)-5,3)=2)*($E$2:$FG$2<>""),LOOKUP($E$2:$FG$2,FTE_Lookup_1,FTE_Lookup_2)))
being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting Edit mode. If done correctly then excel will put {} around the formula.
Related
I need to create a function that will fill in cells Sheet2!G25:P25 according to three criteria: project type, criteria type, and date. The problem is that the criteria in Sheet 1 aren't lined up to conveniently use a VLOOKUP or INDEX MATCH. I know I'm supposed to list the formula that doesn't work but I honestly haven't even been able to get close. I've been primarily working on variations of the SUMPRODUCT such as
=SUMPRODUCT((Sheet1!A3:A19=Sheet2!A25)*(Sheet1!D3:D19=Sheet2!B25)*(Sheet1!G2:P2=Sheet2!G23)*Sheet1!G3:P19)
but that obviously won't work since the project type and criteria type aren't on the same row as the data I need. A work around I've been trying is to OFFSET the location of the cell found in the SUMPRODUCT project type and criteria type arrays but restrictions within the OFFSET function has set me back. For example, the reference section of the OFFSET function cannot be a function even if the function pulls a cell location (OFFSET(CELL("address",INDEX MATCH),0,0). The goal of this was to trick the SUMPRODUCT function into thinking that the 2 row criteria were on the same row. You guys are geniuses when it comes to this stuff so I'm sure I'm missing something.
=SUMPRODUCT((Sheet1!A3:A19=Sheet2!A25)*(Sheet1!D3:D19=Sheet2!B25)*(Sheet1!G2:P2=Sheet2!G23)*Sheet1!G3:P19)
Well, the following works for me on the basis or your example.
The condition here is that the row separation between your project and the criteria is always 4 rows apart
The formula on Sheet 2 is
{=INDEX(Sheet1!$A$1:$U$19,MATCH(1,(Sheet1!$A$1:$A$15=$A$3)*(Sheet1!$D$4:$D$18=$B$3),0)+1,MATCH(H1,Sheet1!$A$1:$U$1,0))}
This is an array formula, enter it by usind Ctrl+Shift+Enter
On sheet1 if positioned the data same as on your picture, that means the first date is in H1 on Sheet 1
The first formula entered on Sheet 2 is in cell H3
The "trick" I used is to simply offset the second search array:
Project uses A$1:$A$15
Criteria uses $D$4:$D$18
Not really an Excel user, but what seemed simple has turned out to be very difficult for me. I am in trouble as I can't come up with a nice and clean (or any) way to get it working.
What I have here:
I need to create a new columnn that would tell the amount of employees in each occupation while ignoring the duplicates (highlighted).
The amount of names formula is working, so maybe this can be used ? Or maybe it's just in the way and should be cleared.
It's just:
=COUNTIFS(A:A;A2)
Tried searching for quite a while did not find anything suitable. Any help or advice would be much appreciated. I hope I explained it in clear manner.
Thank you
Without helper columns:
Two options, D2:
{=SUM(--(FREQUENCY(IF($B$2:$B$9=C2,MATCH($A$2:$A$9,$A$2:$A$9,0)),ROW($A$2:$A$9)-ROW($D$1)+1)>0))}
Or put in E2:
{=SUMPRODUCT((($B$2:$B$9=C2))/COUNTIFS($B$2:$B$9,$B$2:$B$9&"",$A$2:$A$9,$A$2:$A$9&""))}
Notice both are array formulas and should be entered through CtrlShiftEnter
SUMPRODUCT 'Deals' in Arrays 3
You might have employees with the same name (David, Michael) in different occupations (Tech & Worker, Tech & Economy). To distinguish those from each other, in B2 you can use:
=SUMPRODUCT((A$2:A$21=A2)*(C$2:C$21=C2))
In D2 you can use:
=SUMPRODUCT((1/B$2:B$21)*(C$2:C$21=C2))
Distinct Employees Occupation Count
with a helper column
Unique and Distinct values are tricky. Using a helper column is beneficial for identifying either one of these when coupled with an expanding range:
=SUMPRODUCT((A2=$A$1:$A1)*(C2=$C$1:$C1))
Relative Rows: ^ ^
Paste to cell E2.
Copy Drag the formula down from the where pasted.
The relative row numbers identified above well increase as the formula is copy dragged down. This creates a larger and larger range for comparison. An expanding range.
In this case the range that is expanding is the range of already checked values. Many times the result range is expanded and tested against to eliminate posting duplicates of already posted results in subsequent rows of the results list.
The helper column's value is how many times the name and occupation pair has previously appeared. Zero previous appearances tells us this is the first occurance. We will only count the zeros (first occurance) in the main formula.
The main formula for counting distinct employees in each occupation:
=COUNTIFS( $C$2:$C$9, C2, $E$2:$E$9, 0)
Paste to cell D2.
Copy Drag the formula down from the where pasted.
Here we count all the rows for this row's occupation where the occupation matches the range of listed occupations and for that particular row in the list of occupations, the helper column row value is zero.
Add a final column which is the concatenation of the prior 3 columns then use
=SUMPRODUCT(1/COUNTIF(D2:D9,D2:D9))
There is a good explanation of this formula here. Basically, values that appear once will count as 1. Values that appear more than once will appear as fractions of their total occurrence count and be summed to 1.
If you convert your data to an Excel table by selecting a populated cell in the range and pressing Ctrl+T, then formulas will auto-populate down last column. You can then reference the table columns in the formula and you won't need to amend the formula as you add rows.
My problem:
I have the below tables:
In my second table (tbl_analysis), I need to create a formula in the Sum column that will sum the salary of a certain person over a certain period. When the period changes, the formula needs to be recalculated.
My try:
I started off by using the formula:
=SUM(my_range)
By the range can't be hard-coded, so I decided to find the cell address of the corresponding month as you can see in the range D12:E15
Formula in the cell D12:
=CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0)))
So when I tried to insert the above formula inside of the SUM formula like this:
=SUM(CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0)))
: CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(C12,$A$2:$M$2,0))))
And then Excel is referecing the cell address itself and not the address inside of the formula.
Skip the Addresses and use this based on the months:
=SUM(INDEX(A:M,MATCH(A12,A:A,0),MATCH(B12,$2:$2,0)):INDEX(A:M,MATCH(A12,A:A,0),MATCH(C12,$2:$2,0)))
Scott Craner has the right solution for this scenario and it makes more sense here. However if you would absolutely need to get cell reference from a cell you would be able to do it using the following function:
INDIRECT(cell)
Usually this isn't necessary but it can be handy when you want to break up a long formula where you would need to find a row number for example.
INDIRECT("A" & B2)
Where B2 has the row number for a dynamic range or specific moving target row.
INDIRECT function documentation
I want Excel to check whether two time intervals intersects or not.
For example, I3-J3 and I5-J5 intersects.
How can I make Excel to show this intersection in another cell?
The following formula will reveal any interference for the last row. Just copy this formula into cell K3 and copy it down:
=IF(OR(AND(OR(I3>(I$2:I2)),OR(I3<(J$2:J2))),AND(OR(I3>(I$2:I2)),OR(I3<(J$2:J2)))),"interference","OK")
Note that this is an array formula which will have to be entered using Ctrl+ Shift + Enter. For more information on array formulas you might want to read the following article: https://support.office.com/en-us/article/Guidelines-and-examples-of-array-formulas-7D94A64E-3FF3-4686-9372-ECFD5CAA57C7
If you want to show interference for both rows then you'd have to expand upon I$2:I2 and J$2:J2 to include the entire list. So, this might be (for example) I$2:I$500 and J$2:J$500 respectively. Yet, you cannot include the row itself. Otherwise, you'd always get interference because the formula would check against itself. So, you'd have to generate individual formulas for each row and you cannot enter a generic formula and copy it down.
I am not sure how to show (with formulas only) the interfering entry. This is mostly due to the fact that there might be more than one interfering entry which would then have to be listed and separated by ,. I don't think that can be done with formulas only.
Note: the above solution is based on the basic principle that all dates and times in Excel are (essentially) just numbers formatted as dates or time. For more information you might want to read the following: Change date format using substitute or replace
So, the above formula is just checking if the date in column I is between any prior date in column I and column J. If the date in column I is > and prior date in column I and also < compared to the date in column J then this is an interference. The same has to be checked for the date in column K and then both have to be combined with an OR. That's the entire formula above.
Update:
Based on the comment provided by #Gordon the formula can be improved with the COUNTIFS function. Just enter the following formula into cell C2 and copy it down:
=SUM(COUNTIFS(A:A,"<"&A2,B:B,">"&A2),COUNTIFS(A:A,"<"&B2,B:B,">"&B2))
Any number greater than 0 means that there is at least one interference. With this formula it is now counting / showing multiple interferences as you can see in the following screenshot:
Note, that the improved formula does not require anymore for you to know the range of the table. Instead you can search the entire column A:A and B:B for interferences.
Ex.
column A is a formula that outputs an 8 digit ID from a prior delimited calculation. I want to vlookup that ID to a separate set of data, but it is not finding the ID when the lookup value is part of a formula.
Is there a way to paste the formula result as a value in column b?
I have a list of 3000+ IDs, so using the F2, F9 trick won't work, since I would have to do that cell by cell.
Would prefer not to use VBA, but if that is the only way, can someone help simplify that process (new to using VBA)
If you have data in column A based on a left function of a bunch of numbers, and just want that result in column B, all you have to do is put:
=Value(ColRow)
in Column B. Then you can look up the value in Column B via VLookUp.
I am an avid Excel user and personally tested this solution. Though it appears #Scott beat me to it in the comment section.