Sharepoint, Calculated column, IF function and date - sharepoint

I am trying to add a calculated column.
I have a date column containing the date a meeting is scheduled. From this column I need a code which can return if the meeting is scheduled in Q1, Q2, Q3 or Q4. I have a static code looking like this:
'=IF(Date<40269;"Q1";"Q2-4")' (40269 is the 1. April 2010 and Date=date-column)
But I need somekind of dynamic code which can calculate the same thing next year as well, without someone having to change the number(40269). I need something like this:
'=IF(Date<01-01-&year(today);"Q1";IF(Date<01-04-&year(today);"Q2";IF(Date<01-07-&year(today);"Q3";"Q4")))'
But Sharepoint will not accept a date written like this 01-01-2010, it needs to be a number eg. 40269. The above code will only work correct for the present year, but thats all-right, since I will only use data from the present year.
Can anyone help me?

Ahhhh... It was easier than I had anticipated. I used this function:
=IF(MONTH(Date)<4;"Q1";IF(MONTH(Date)<7;"Q2";IF(MONTH(Date)<10;"Q3";"Q4")))
Date is a column containing the date of the meetings. month() returns the number of the month. E.g., march=3.

Related

Get sum of cells containing "Vacation" except when related date matches certain day & month

oversimplified i have two columns: Date and Text; I want to check my current amount of vacation days based on the first date in row 2, so i came up with the following formula:
="Available vacation days: "&YEARFRAC(A2;TODAY())*12*(25/12)
I calculate the fraction of the year based on the first date and todays date, multiply it by 12 to get months and multiply it again by the total amount of vacation days in my contract per month. Now i got another formula to collect me all cells in column B containing "Vacation", pretty straight forward:
=COUNTIF(B:B;"Vacation")
Now the interesting part - i got the formula who gives me a boolean if a datetime matches the 24th or 31st of december:
=AND(OR(DAY(A53)=24;DAY(A53)=31);MONTH(A53)=12)
I want to count vacation days happening on a 24th or 31st of december as a half-vacation day (0.5), and otherwise fully (as a 1). Then i want to combine my first statement with this result and subtract the used vacation days. I read about VLOOKUP and XLOOKUP but am unsure if this fits this purpose. I want to avoid having an extra column with my boolean returns and rather have this one cell giving me all the information combined.
Without introducing another column, and using DAY and MONTH
It's nearly impossible, and just unnecessarily so...
Please reconsider this, what will happen if you want to add 4th of July as a holiday?
Your formula =AND(OR(DAY(A53)=24;DAY(A53)=31);MONTH(A53)=12) only works for 1 row at a time. So, we can't ever use it with a list, because you will get the whole list as a result every single time. You can't divide them into smaller lists and join them together, there is no such functionality without VBA.
In the future, do not set arbitrary constraints like "no additional columns", you can hide them if you don't like them. And if you don't need them, remove unnecessary rows like non-vacation rows. They are irrelevant, so why not separate the two.
Just to prove my point, here's the solution you wanted:
Solution
=COUNTIFS(B2:B9;"Vacation") - (COUNT(IFERROR(FILTER(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12);DAY(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12))=31);0))+(COUNT(IFERROR(FILTER(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12);DAY(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12))=24);0))))*0,5
It works, but it's a pain to read, use and maintain.
A2:A9 refers to the dates column
B2:B9 refers to the text column
So in the future, the last thing you want to do is set arbitrary constraints. Furthermore, why use functions like MONTH and DAY when we can just read the text? That way you could even create a table of holidays to search for instead. That will be no fun task with this setup. (Oh, and if it's because of the year, just strip it away from the text when you want to know only the month and day.
Best of luck!

Excel - count WORK days in each month between two dates

I'm trying to figure out the number of workdays between two dates for each month. I have found this answer already and it works just fine for the days.
I would now like to know, how many workdays there are in each month. Meaning (again based on the linked answer), I'm here:
and would like to get to this here:
There is a function called Networkdays. You can find details here and here. You will need to know which holidays you have in-between.
I usually generate a list of all dates in a calendar year (or download it) and then mark the holidays I want to exclude with an x.
You are looking for the NETWORKDAYS function.
Based on the linked result, something like the below should work (and be easy to modify based on how your sheet is set up):
=IF(
IF(C2$3>$B2, NETWORKDAYS(B$2+1, $B2), NETWORKDAYS($A2, C$2)-SUM($B3:B3))<0,0,
IF(C2$3>$B2,
NETWORKDAYS(B$2+1, $B2),
NETWORKDAYS($A2, C$2)-SUM($B3:B3)))
For example:

Extracting data by date (today-function) but don't want data to change over time

I'm helping colleagues to extract data from a big table of info entered by week. The problem is that I want the date to be true at that moment and not the next month menaning that for a specific month the data should be extracted and not changed after that. My formula compares the date in a cell plus/minus a certain amount of given days and turnes this into a weeknumber. This is then compared with the sheet with all the data. So let's say that for end of October I need to extract the info from column F as the info looks in october. The info in column F is changed all through the year. So I want a snapshot of the data in October. Then next month I want a snapshot of the data in column F what it looks like in November.
My problem is that it changes for every month so when november comes, october becomes 0 and it only calculates for the current month. Since I use the today()-function I guess this is how it should work but I'd like the formula to only execute as the month is true and only once. Is this even possible?
I've been starting to think that I might need to create a macro but I didn't want to do this. However, it seems that this might be the only way?
Kind regards
David Albady
Instead of TODAY() in the function, you may use =DATE($C$1,$D$1,$E$1) . Where C1,D1,E1 is the year, month, day that you can manually define.
Hope that helps. ( :

Time series mock data generation for 16 years of quarterly data in Excel or Matlab

I would like to generate a mock time series quarterly dataset from, say, 2000-2016 for a variable (quarterly credit growth) that averages around a certain value (say, 30%). Can anyone give a suggestion on how to do this in principle?
Edit: what I was implying were the actual data values for each time period, i.e. data with a certain mean and variance.
Found a solution with a code in Matlab, for anyone interested, see below in answers.
Excel approach:
You can make column A your date list. In A1, or A2 or more if you have header rows, you will have to seed your list by providing the first start date. Lets assume you put your seed date in A2. I would then go about adding 3 month to you start date using a formula, and copy down until you have hit your desired date. In order to add the 3 months I would use the following in A3.
=date(year(A2),Month(A2)+3,day(A1)
that will give you the first day of the month every 3 months. If you want the first day of the month every 3 months, set the day to 1 like so:
=date(year(A2),Month(A2)+3,day(A1)
And end of month could be calculated as:
=eomonth(date(year(A2),Month(A2)+3,day(A1)),0)
however I would prefer to do the end of month calculation based on the row you are in so I would do it more like:
=EOMONTH($A$2,(rows($A$2:A3)-1)*3)

Creating a sum based on a category within a date range

I'm trying to make a spreadsheet that I can easily take an export from Mint.com's CSV outputs and get them into my Excel budget.
To do so, I need a way to populate each field within a date range. I'd like to avoid macros if possible (I don't know how to make them).
I'm happy to share my finished .xls with the public!
I've imported Mint.com's data in a manner that has column S for the date (3/30), column V with the cash value that I need to add up, and column X for the spending category.
I need to tally each month's spending ($V) by category (column X).
Through research, I devised this (for my January "Gas & Fuel" spending):
=SUMIFS($W$2:$W$900, $T$2:$T$900, ">="&W$12, $T$2:$T$900, "<"&(EOMONTH(D$1,0)+1), $Y$2:$Y$900, "="&$B5)
However, it required that I reformat my Dates, which is an issue because this would become specific to each year and I would need to change the fields every year. I'd like the document to be usable without adjustment using my spending data from the past and future.
Is there a way to take the year out of the equation? To make that formula above work, I renamed my column from "January" to "1/14".
Here is what the spreadsheet looks like
Thanks!
A pivot table would work best with that data.
Initial set up would show each day separately, but by using Grouping
(here) ^^^
you can group the data by month/day/year/however

Resources