IF value in list, perform VLOOKUP and add result - excel

I have a list of employees, a column stating their 'available days multiplier' (eg a full time employee would be 1.0, a part time employee working 4 days out of 5 would be 0.91, 3 days would be 0.80 and so on. The next column calculates the employees available holidays, based on a standard 30 days multiplied by the 'available days multiplier'. See below, with an example formula in brackets :
A B C
1 Name | Available Days Multiplier | Holidays
2 Employee A | 1 | 30 (=30*B2)
3 Employee B | 0.91 | 27
4 Employee C | 0.91 | 27
5 Employee D | 1 | 30
Employees have an option to purchase additional holidays, which I have stored in a separate table containing 'Name' and 'Days'
S T
1 Name | Purchased Days
2 Employee 2 | 5
3 Employee 4 | 3
I would like to amend the formula in column C to not only calculate the holidays based on available days multiplier, but also to look up the list in columns S:T and add on any purchased days, if the employee name is found.
I suspect this could be quite easy with an IF/VLOOKUP combination, but I cannot find the correct syntax. Any help greatly appreciated.

If I have understood correctly, you could use SUMIFS:
=(30*$B2)+SUMIFS($T$2:$T$3,$S$2:$S$3,$A2)
This works by first calculating the number of holidays as you have been doing and then adding any purchased ones.
If the employees name appears more than once in the list, it will add the total sum of purchased holidays to the total.
SUMIFS sums the first range (T2:T3) if the second range (S2:S3) matches the criteria (A2).
Hope this helps. If you need further clarification, please let me know.

Related

In Excel how do I find a column then sum between two dates?

In excel I have a pivottable:
Project
11/1/2021
11/2/2021
11/3/2021
Dept 1
5
5
5
Dept 2
2
5
5
Dept 3
5
4
6
Dept 4
5
3
5
The table spans the full length of the month. I need a calculation that would find the department I input then sums all figures between today's date and the last day of the month:
Dept
Total
Dept 1
15
I have tried
=SUMPRODUCT(((Today()<=B1:K1)*(EOMONTH(TODAY(),0)>=B1:K1))*(A2:A5="Dept 1")*(B2:K5)
and various different vlookups but I can't figure out how to both find the correct row and then sum everything between the two dates in that row.
Assuming the following structure:
Try this, it works:
SUM(INDIRECT(ADDRESS(MATCH($B$2,$A:$A,0),COLUMN($B$6))&":"&ADDRESS(MATCH($B$2,$A:$A,0),MATCH($B$3,$6:$6,0)),TRUE))

Check if a Cell Value is between Two Values using Vlookup

In Excel, I have a table as follows, which shows pricing based on volume.
If you buy up to 4 items per month, the unit price is $100, 5 to 8 is $90, 9 to 20 is $80, anything above 20 is $50.
A | B | C
----------------
1 | 4 | 100
5 | 8 | 90
9 | 20 | 80
21| 1000 | 50
I have my monthly purchase volumes in another column, say d:
D
--
3
6
2
4
3
10
7
7
10
2
I need to find the unit prices (C column values) based on this series falling between the values of A and B columns. I know I can use a compound if statement like =IF(AND(D$1>=A1,B1>=D$1),C1,0) ... but since my pricing table is actually much larger than my example, this approach becomes convoluted. How can I do this with a Vlookup in an elegant way?
I'd go with the following in E1:
=INDEX(C$1:C$4,MATCH(D1,A$1:A$4))
which, at worst should be just as fast as VLOOKUP but at best is much faster.
This can be done by dragging the following formula down to cover the full column D:
=LOOKUP(2,1/($A$2:$A$5<=D2)/($B$2:$B$5>=D2),$C$2:$C$5)
This will take each D value, compare with A and B, locate which bucket it falls into, and pull the C value. If not found, will return an N/A.
Here is an approach using SUMIFS:
=SUMIFS($C$1:$C$4,$A$1:$A$4,"<="&E1,$B$1:$B$4,">="&E1)

Cumulative prices based on dates that cover different pricing periods

I am trying to calculate how much someone needs to pay me, where the ticket prices are set for a certain period.
Guest Name | Arrival Date | Departure Date | adults | Child | Total |
J.Bloggs | 14/11/2019 | 18/11/2019 | 5 | 2 | 7 |
Price 01/11/2019 ~ 04/11/2019 = £3.40
Price 05/11/2019 ~ 15/11/2019 = £2.50
Price 16/11/2019 ~ 30/11/2019 = £1.90
I need to workout how to charge J.Bloggs £2.50 for 2 nights (14th & 15th) then £1.90 for 3 nights (16th, 17th and 18th) = £10.70 * 7 people = £74.90
The blue columns is the raw data, the green columns are formula based (I don't need the Price column, I was just using to work out the fees).
This is the formula I have in the price column at the moment, but know that won't work when the tickets are covering multiple periods.
{=INDEX(Pricing!$C:$C,MATCH(1,(Pricing!$A:$A<=IF(ISTEXT($A2),DATEVALUE($A2),$A2))*(Pricing!$B:$B>=IF(ISTEXT($A2),DATEVALUE($A2),$A2)),0))}
Use SUMPRODUCT with INDEX/MATCH:
=SUMPRODUCT(INDEX($C$8:$C$10,MATCH(ROW(INDEX($ZZ:$ZZ,A2):INDEX($ZZ:$ZZ,B2)),$A$8:$A$10)))*E2
this is an array formula and requires the use of Ctrl-Shift-Enter instead of Enter when exiting edit mode.
ROW(INDEX($ZZ:$ZZ,A2):INDEX($ZZ:$ZZ,B2)) creates an array of the dates.
MATCH(...,$A$8:$A$10) Takes that array and finds where it falls in the lookup table. Note: the lookup table must be sorted ascending.
INDEX($C$8:$C$10,...) Takes each of those matches in turn and creates an array of the output prices.
SUMPRODUCT(...) adds all the values together.
Then we simple multiply it by the number of guests.

Add business days in start date then subtract 1 business day (Excel)

My count of business days in end date should be, for example, May 30 to May 31 will be 2 days and May 30 to May 30 is already counted as 1 day. My problem with WORKDAY is that it counts the day from May 30 to May 31 as 1 day only.
What I've think of is to subtract the result of WORKDAY with 1 business day to get my desired result. However, with my current formula, I was only able to subtract the result of WORKDAY without concerning the weekends (=WORKDAY(C2,B2-1)).
So for example, column C is June 3 (Friday) and column B is 2. The output of my formula will be June 5 (Sunday) because of the subtraction, I want it to be June 6. How will I do that?
Column B = Duration
Column C = Start Date
Column D = End Date (Formula-based)
Column D:
=WORKDAY(C2,B2-1)
Provide Input
B | C | D
2 | 2016/06/03 |
Desired outcome
B | C | D
2 | 2016/06/03 | 2016/06/06
TRY
=WORKDAY.INTL(C2,B2-1,1)
This will set sat. and sun. as offdays
It is not clear exactly what you want to do.
If you want to do an inclusive count of Workdays from 2016/06/03 to 2016/06/06 then you could just use the NETWORKDAYS function.
If you want to add two workdays to Jun 3, and have Jun 3 count as the first day, to give you the result of Jun 6, then use
=WORKDAY(C2-1,B2)
That takes care of the issue where C2 is not a workday, and you want to count 1 workday as the first workday after C2
Otherwise, your formula should work as written.

excel - calculate date based on number of hours / planner

I'm trying to figure out how to auto generate/populate a column in excel based on the number of hours filled in another column:
Start date: 04-08-2011
Hours in one day: 8
Issues Hours Date
part 1 | 2 | 04-08-2011
part 2 | 6 | 04-08-2011
part 3 | 2 | 05-08-2011
part 4 | 2 | 05-08-2011
part 5 | 8 | 06-08-2011
part 6 | 2 | 06-08-2011
So when i add issue 'part 1' the date starts # the start date, when i add hours or 'parts' it continues to use the start days until it reaches 8 hours and continues to the next day.
Also when im adding a row between the existing rows it automatically recalculates the dates.
Anny ideas where to start? Tnx
If I understand what you are asking correctly, and assuming start date is in Cell B1, and hours in 1 day B2
And data header in A4:C4, with data below
Then put the formula '=$B$1+INT(SUM($B$5:B5)/$B$2-0.1)' in C5
Copy C5 down and it should generate the date automatically
The '-0.1' is to account for exactly 8 hrs being allowed in 1 day

Resources