Build adding [] to "" enclosed value in switch statement - switch-statement

I am writing a query using the switch function. When I enclose the Value in "" in the build window when I go to execute the query Access has enclosed the Value statement in [] and prompts me to provide a value. What am I doing wrong?
The switch statement before I close the build window is:
OverUnder: Switch([zVAR Days Decision-Open]![Priority Level]="Emergency"
And [zVAR Days Decision-Open]! [NewDaysToDecision])<=10,”Under”, , [zVAR Days Decision-Open]![Priority Level]="Emergency"
And [NewDaysToDecision]>10,”Over”, [zVAR Days Decision-Open]![Priority Level]="Level 1"
And [NewDaysToDecision]<=10,”Under”, [zVAR Days Decision-Open]![Priority Level]="Level 1"
And [NewDaysToDecision]>10,”Over”, [zVAR Days Decision-Open]![Priority Level]="Level 2"
And [NewDaysToDecision]<=30,”Under”, [zVAR Days Decision-Open]![Priority Level]="Level 2"
And [NewDaysToDecision]>30,” Over”, [zVAR Days Decision-Open]![Priority Level]="Level 3"
And NewDaysToDecision]<=30,”Under”, [zVAR Days Decision-Open]![Priority Level]="Level 3"
And [NewDaysToDecision]>30, ”Over”)
I'm not sure you can use an And statement to include multiple criteria in a switch statement. Is that the issue?

Related

how to get difference between two dates in sharepoint calculated column

how to get different between two dates: column1 "joining date" column2 "leaving date", in sharepoint calculated column as "total experience of an employee"?
The desired output I'm searching is in this format for example: "2 days 2 months 2 years".
this formula should give you the answers that you are after
= DATEDIF([Date 1],[Date 2],"MD")&" Days "& DATEDIF([Date 1],[Date 2],"YM") &" Months "& DATEDIF([Date 1],[Date 2],"Y") &" Years"
Steps:
Create a calculated column of type Single Line of text
Use the formula above.
Explanation:
Formula goes as
DATEDIF(Start_date,End_date,"Interval")
Where interval can be:
Y Calculate the number of complete years
M Calculate the number of complete months
D Calculate the number of days
YM Calculate the number of months excluding years
MD Calculate the number of days excluding years and months
YD Calculate the number of days excluding years
For 2 dates like Date 1 (31/01/2020) and Date 2 (14/05/2020), the results will be:
14 Days 3 Months 0 Years

DATEDIF and IF Statement in Excel, won't return correct result over 10 months

I am attempting to determine the number of months and days between two dates to determine an group of individuals length of service, so that I can ascertain if they are within 2 ranges 0-6 mths and 6-23mths, I have the following but I'm missing something, as it can't seem to handle 10 months or over, its returning 0-6 mths for those. I will also need to add a third range (0-6, 6-12 & 12-23) for a future project but am having difficulties with this one also?
=IF(DATEDIF(F155,G155,"ym")&" months " &DATEDIF(F155,G155,"md")&" days">="6 months 0 days", "6 - 23 Months","0 - 6 Months")
The problem is that you are comparing 2 strings that do not have the same format:
For example for dates 1/1/2019 with 11/1/2019 you are comparing "10 months 0 days" vs "6 months 0 days" (a 2 digits number vs a 1 digit number in the begining strings). You have to make them the same format to be able to compare:
=IF(DATEDIF(F155,G155,"ym")&" months " &RIGHT("0"&DATEDIF(F155,G155,"md"),2)&" days">="06 months 00 days", "6 - 23 Months","0 - 6 Months")
This way you would be comparing "10 months 00 days" vs "06 months 00 days" and since now they have the same format it will work.
It might be simpler to use VLOOKUP.
And, if you expect to get a range of 12-23 months, why are you using the "ym" argument for DATEDIF? That can never return a value more than 12.
I suggest something like:
=VLOOKUP(DATEDIF(F155,G155,"m"),{0,"0 to 6 months";6,"6 to 12 months";12,"12 to 23 months";24,"undefined"},2)
Also, suggest you read about the different arguments for DATEDIF; and you should probably read HELP for VLOOKUP also.
If you need to extend the table more, consider putting it into an Excel table instead of an array constant.

NETSUITE - Saved Search - Show employees are one year old today

How to make and saved search to verify todays employee has exactly 1 year on company.
Example:
employee1 hiredate = 10/02/2015
employee2 hiredate = 11/02/2015
employee3 hiredate = 10/02/2012
employee4 hiredate = 10/02/2008
employee5 hiredate = 13/04/2008
Get saved search with all employee are 1 or more years old.
The result will be if today are 10/02/2016:
employee1 = 1 year on company.
employee3 = 4 year on company.
employee4 = 8 years on company.
Thats possible?
My wrong formula are:
MOD((ROUND({today},'DAY')-ROUND({hiredate},'DAY'))/365, 1) is 0
Thanks!
You should not need a formula at all for this. You can just set up a filter on your saved search where the field is "Hire Date", the operator is "on or before", and the value is "same day last fiscal year". If you only want exactly one year ago, you can use "on" instead of "on or before".
If you want Employees that are more than 1 year but less than 2 years, then just add a second filter of "Hire Date - on or after - same day fiscal year before last".
I was able to achieve the same using the below formula(numeric) filter:
MOD(MONTHS_BETWEEN({today}, {hiredate}),12) is equalto 0
this will give you the employees having anniversary.
To get the number of years add the formula(numeric) search column with formula:
FLOOR(MONTHS_BETWEEN({today}, {hiredate})/12)

Working Hours Excel Formula

I need to calculate the working hours elapsed between two dates and times, for example:
Holiday taken between 01/09/2014 and 05/09/2014
5 working days # 8 hours per day.
I need the result to show me how many working hours that would be. For example:
ANNUAL ENTITLEMENT: 89.9 Hours
DATE FROM DATE TO RETURN TO WORK HOURS REQUIRED HOURS REMAINING DATE
01/09/2014 05/09/2014 06/09/2014 40 49.90
I have no idea if this is even possible!
I am assuming these are given cells. if you type in the date to a cell you can click on a new cell and put uptop by the fx this
for example. In C1 you can type this into the fx. Make sure you put the equal sign.
=B1-A1
This is what is the dates in the cells
A1 = 1/9/2014
B1 = 5/9/2014
This will give you 120 which is the total days inbetween.
You will want to get the number of weeks so you can divide by 7.
You will multiply weeks by number of days worked which is 5
Then you want the weeks times 8 hours you can do this in C1
=(B1 - A1)/7 * 5 * 8
which gives you 685.7143
you need to also take into account weekends which a simple subtraction will not do. Firstly find the total number of days:
TOTAL_NUMBER_DAYS = B1-A1 + 1
then calculate how many weekends:
TOTAL_WEEKENDS = WEEKNUM(B1) - WEEKNUM(A1)
finally take the total days and subtract weekends:
NET_TOTAL_DAYS = TOTAL_NUMBER_DAYS - (TOTAL_WEEKENDS * 2)
TOTAL_HOURS = NET_TOTAL_DAYS * 8
I solved this recently and had a working solution initially in Excel 2013. Slightly adapted to work in 2007 (lack of 'Days()' function). We use it for reporting on support tickets (length of time between opening and closing a ticket).
Inputs are "Workday start", "Workday end" from which "Hours worked" and "Hours not worked" are calulated.
Hours worked =HOUR(WorkEnd-WorkStart)+(MINUTE(WorkEnd)+MINUTE(WorkStart))/60
Hours not worked = 24 - Hours worked
Further inputs are a table ("Data") with first two columns "Open" and "Close", which are dateserial cells.
Next column is standard numeric value "Gross hours" =(Data[[#This Row],[Close]]-Data[[#This Row],[Open]])*24
Next column is standard numeric value "Net workdays" =NETWORKDAYS(Data[[#This Row],[Open]],Data[[#This Row],[Close]])
Next column is standard numeric value "Net days" =MAX(1,DAY(Data[[#This Row],[Close]])-DAY(Data[[#This Row],[Open]]))
Next column is standard numeric value "Gross workhours" =IF(Data[[#This Row],[Gross hours]]>0,Data[[#This Row],[Gross hours]]-24*(Data[[#This Row],[Net days]]-Data[[#This Row],[Net workdays]]),0)
Last column is standard numeric value "Total work hours" =IF(Data[[#This Row],[Gross workhours]]<24,Data[[#This Row],[Gross workhours]],Data[[#This Row],[Gross workhours]]-(HoursNotWorked*Data[[#This Row],[Net workdays]]+HoursWorked))
This solution makes it trivial to adjust start and end work times, as well as accounting for any holidays (via a small change to the NETWORKDAYS() function to utilise the optional parameter).

Shell script to find the date 12 working days(ignoring holidays) from today

I'm having a little trouble trying to write a bash script that would find the date 12 working days later than the current day (ignoring holidays as that would complicate things quite a fair bit). A working day in this case would be Mon-Friday.
I'm not even really sure where to start with this! Any starting pointers would be great :)
I assume with workday you mean a day from Monday to Friday (even if Saturday might officially be a workday as well).
Sometimes twelve working days in the future is after three weekends, sometimes after two weekends. So we have to find out whether we are on a Thursday/Friday or on Monday/Tuesday/Wednesday or on Saturday/Sunday. It turns out that Sunday is the same case as Monday/Tuesday/Wednesday, so we end up using this:
weekday=$(date +%w) # 0 is Sunday, 6 is Saturday
if [ $weekday -lt 4 ] # Sunday/Monday/Tuesday/Wednesday
then
offset=16
elif [ $weekday -lt 6 ] # Thursday/Friday
then
offset=18
else # Saturday
then
offset=17
fi
date -d "today + $offset days"
Add 16 days (12 working days = 5 + 5 + 2, so in general days it is 7 + 7 + 2). For Thursdays and Fridays, you have to add two more days to skip weekends.
#! /bin/bash
increment=16
day=$(date +%w)
[[ $day == [45] ]] && (( increment += 2 ))
date -d "+$increment days"
Using the -v option to date the advance date can be found.
There will be 16 days elapsed (includes 4 days of Saturdays and Sundays)
unless the day is Thursday or Friday: in which case there will be 6 weekend days.
dn=$(date +'%w') # 0 = Sunday, 1 = Monday etc
days_inc=16
if [ $dn -gt 3 ];then
days_inc=18
fi
date -v +${days_inc}d

Resources