VLOOKUP copies and paste existing value instead of looking up table - excel

I'm having real difficulties with a VLOOKUP formula on an excel spreadsheet. Instead of bringing back the correct values it appears to be copying and pasting the answer from the first cell.
Table 1 is:
uprn Day and Week
10024239501 Friday 2
452061980 Friday 1
452026455 Thursday 1
452010090 Thursday 2
452015382 Wednesday 2
452034567 Wednesday 1
452058333 Tuesday 1
452033532 Tuesday 2
452047401 Monday 1
452060801 Monday 2
table 2 is
uprn letter
10024239501 a
452061980 b
452026455 c
452010090 d
452015382 e
452034567 f
452058333 g
452033532 h
452047401 i
452060801 j
the vlookup formula i've used in table 1, column 3 is:
=VLOOKUP(A1,$F$1:$G$10,2,FALSE)
When I then drag this formula down for the rest of the table it gives me the following:
uprn day and week letter
10024239501 Friday 2 a
452061980 Friday 1 a
452026455 Thursday 1 a
452010090 Thursday 2 a
452015382 Wednesday 2 a
452034567 Wednesday 1 a
452058333 Tuesday 1 a
452033532 Tuesday 2 a
452047401 Monday 1 a
452060801 Monday 2 a
I've made sure that cells are numbers and text in each table, but still it only appears to be working for the top value and then copying this result down for the rest of the table.
What I would expect in a correct VLOOKUP table would be:
uprn day and week letter
10024239501 Friday 2 a
452061980 Friday 1 b
452026455 Thursday 1 c
452010090 Thursday 2 d
452015382 Wednesday 2 e
452034567 Wednesday 1 f
452058333 Tuesday 1 g
452033532 Tuesday 2 h
452047401 Monday 1 i
452060801 Monday 2 j

Related

How to count number of times someone's tenure falls into each month range in Excel

I am trying to count the number of months someone's tenure falls into each range but am struggling to come up with a formula that works. For example:
Year-End Tenure Year-Start Tenure Month 1-6 Month 7-12 Month 13-24
23 12 0 1 12
56 45 0 0 0
11 0 6 5 0
The first employee starts the year having worked for this company for 12 months and ends the year having 23 months tenure. Therefore, they spent 0 months in the Month 1-6 bracket, 1 month in the Month 7-12 bracket, and 12 months in the Month 13-24 bracket.
The following two examples follow the same logic. I need a formula to calculate the numbers in Month 1-6, Month 7-12, and Month 13-24 columns.

Repeat items in list for schedule

I’m trying to make a program that tells a shift worker what days he/she is on and what days he/she is off. For example, on 4, off 4.
Here’s my code:
schedule = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday']
on = 4
off = 4
count = 0
while count < 3:
for x in range(on):
print('on: ', schedule[x])
for y in range(on,len(schedule)):
print('off: ', schedule[y])
count = count + 1
This prints:
on: monday
on: tuesday
on: wednesday
on: thursday
off: friday
off: saturday
off: sunday
X3
What I’m trying to get it to do is:
on: monday
on: tuesday
on: wednesday
on: thursday
off: friday
off: saturday
off: sunday
off: monday
on: tuesday
on: wednesday
on: thursday
on: friday
And so forth.
I think you can simply create a dictionary where you will map Key:Value pair as Days and status and then iterate through it.
for example
schedule = {'monday':"on",'tuesday':"on",'wednesday':"on",'thursday':"on",'friday':"off",'saturday':"off",'sunday':"off"}
and then iterate through the Schedule dict
for day, status in schedule.items():
print(f"{day}:{status}")

Get the first Friday of the Quarter of Today's Date

I was trying to get the first Friday of the quarter of today's date or any given date. Let's say the date is 12/06/2020, which falls to the 2nd quarter of the year. I should be able to get the first Friday of the 2nd Quarter and that should be April 3rd.
I was only been able to get the quarter of a given date, which you can see in the code below. Been stuck here for a while. Thanks in advance.
quarter = Int((Month(Now) + 2) / 3)
Here's a function that takes a date and returns the first Friday of the quarter:
Function FirstFridayOfTheQuarter(MyDate As Date) As Date
Dim FirstDayOfTheQuarter As Date
FirstDayOfTheQuarter = DateSerial(Year(MyDate), Int((Month(MyDate) - 1) / 3) * 3 + 1, 1)
FirstFridayOfTheQuarter = DateAdd("d", (13 - Weekday(FirstDayOfTheQuarter)) Mod 7, FirstDayOfTheQuarter)
End Function
This function is taking advantage of the Weekday function that returns:
1 for a Sunday
2 for a Monday
3 for a Tuesday
4 for a Wednesday
5 for a Thursday
6 for a Friday
7 for a Saturday
In case you want a non VBA solution:
My formula is:
=CEILING(EOMONTH(DATE(YEAR(A1);ROUNDUP(MONTH(A1)/3;0)+(ROUNDUP(MONTH(A1)/3;0)-1)*2;1);-1)-5;7)+6

How to count days excluding weekends and holidays but start day/end day can be weekends /holidays?

How to count days excluding weekends and holidays in excel. However, start day and end day can be weekends or holidays.
I have tried Networkdays function in excel using MAC. I also tried workdays function. And, i am new to this forum. Let me know if you are not able to understand anything.
Start Date(E) End Date (F)
2019-07-20 - 2019-08-01
2019-08-04 - 2019-08-06
2019-08-05 - 2019-08-07
2019-08-02 - 2019-08-07
2019-08-14 - 2019-08-20
Holiday list
Date(K) Description Day
8/12/19 - Eid - Monday
8/15/19 - Independence Day - Thursday
Excel formula:
= NETWORKDAYS(E2,F2,$K$7:$K$27)
Start date: Column E, End date: Column F, Holiday list: Column H
output expected output
9 8
2 1
3 1
4 2
4 2
Try using NETWORKDAYS.INTL to make sure that your weekend days are set to fall on Saturdays and Sundays.
For example:
=NETWORKDAYS.INTL(E2+1,F2-1,1,$H$2:$H$3)
Result:

Count num of values within range on every Nth cell

We have a data-set generated by an HR system of staff times, which isn't in the most helpful of formats.
We need to count the # of staff who start work before 10.00, and split those counts by week number (1-4) and day (Sun-Sat).
Every group of rows (1-4) is an individual.
Here's an example day's data:
Week Start
1 -
2 10:00
3 09.00
4 09.55
1 09:25
2 10.00
3 10:25
4 10.25
1 09:25
2 09.55
3 08:00
4 10.00
1 10:25
2 09.25
3 09:25
4 10.15
1 10.00
2 08:25
3 09.45
4 11:25
So I can count the occurence of start times before 10am on the entire column with:
=COUNTIFS(L5:L203,">=00:30",L5:L203,"<=10:00")
but to do separate counts for every 4th row (so sum all for ones on week 1, all on week 2, etc) is beyond me.
I tried the following after searching similar questions, but it didn't work:
=COUNTIFS((MOD(ROW(L5:L203),5)=0),">=00:30",(MOD(ROW(L5:L203),5)=0),"<=10:00")
Ideally I'd be able to put values into a table with a count for week 1 on Sunday, week 2 on Sunday, week 1 on Monday, and so on.
Any ideas?
To count the weeks use:
=COUNTIFs(B$2:B$21,"<=10:00",$A$2:$A$21,"=1")
=COUNTIFs(B$2:B$21,"<=10:00",$A$2:$A$21,"=2")
Changing =1, =2, =3, =4 for each weeks count. If column B is Monday and column C is Tuesday, you can drag the above formulas right across the row to get the weekly counts for other days.

Resources