Format date and Value - excel

I have a synchronized List from SharePoint in Excel with Date, Names and sold items to sume.
The Date appears as Datetime(2017-01-01 13:00:00).
In order to do a Pivot Table I wanted to Format it so only appears the month and the year. (January 17).
The Problem is, although the Date is in Month-Year Format, when I do the Pivot table it seems to get the original values of the date, so it doesn´t recognize "January 17" as a Month and it repeats the field several times because it still recognize it as a DateTime value and I can´t get the sold items of one month.

Please have a column to convert the format 2017-01-01 13:00:00 to January-17
If the datetime is in cell A1 use the formula below,
=TEXT(A1,"mmmm-yy")

Related

Conditions in Excel: skip cells with dates without a year

I have the results of a survey with birthdays in various date formattings.
01.01.1990
02/03
04.05 etc.
Every time Excel sees a day and a month without a year it implies the current year and puts it in the cell without any hesitation. So, when we try to extract a year, we get not the error we expected but the current year, which is nonsense.
How can we avoid this behaviour?
The desireable result is:
One column with one formula
If the year is written, we extract it using =YEAR()
If it is absent, we just do anything else, for instanse put "".
Basic change of formatting doesn't change the implication of the current year. And if we change the format of the whole column from date to text, we cannot use the formula "YEAR" anymore to any of the cells.
This is a task for students who can deal with Excel and Google Sheets only, Python is not an option.
I would be very grateful for any help!
Both Excel and Google Sheets stores date as a number (day count) starting from 1900/01/01 so it either assumes year for you or doesn't recognize it as date at all.
If you convert date to number, 1900/01/01 will be 1, 2023/01/16 will be 44942 (as it is 44942 day counting from 1900/01/01).
I assume that survey can't be filled by people born this year so just "filter" them out:
If date is in A1 use formula:
=IF(OR(YEAR(A1)=2023,YEAR(A1)=1900),"",YEAR(A1))
This will print nothing if captured year is 2023 or 1900 (this behavior also possible when dealing with dates without years).

Excel Power Pivot - connect day with dates

I am trying to create a pivot table in excel. I have the following data: person's name and surname, the range of dates during which they were on vacation, the starting date, and the number of vacation days. I would like to create a summary where I would have months in rows and then people. In the column headers, I would like to have days - from 1 to 31. In the appropriate places, I would like to have marked days worked. Example: Julia X was on vacation from 01.01.2022 to 05.01.2022. I would like the columns with values 01,02,03,04,05 to have marks. How can I do this?
I have created an additional table where I have values of days from 1 to 31. I also have all the dates in the year from 01.01.2022 to 31.12.2022, and each date also has the given week. I tried to merge them, but I am failing.
enter image description here

Using COUNTIFS with different date formats

I am trying to calculate the totals of a column when the date column is within a certain month. The value to find is in a different date format to the format in the criteria range and I can't figure out how create a formula using the two different date formats. Here are the columns where I am trying to get the totals from:
Here is where I am trying to count the rows when it falls within a certain month and year:
This is the formula I have created but this doesn't work and just returns 0:
=COUNTIFS($A$3:$A$27, YEAR(G3), $A$3:$A$27, MONTH(G3))
I have also tried this but it is still returning 0:
=COUNTIFS($A$3:$A$27, "=YEAR(G3)", $A$3:$A$27, "=MONTH(G3)")
Format is irrelevant if your dates are REAL dates
If your dates are "real" dates, merely formatted a certain way
And if your Months are also real dates where the date is actually the first of the month,
Then:
=COUNTIFS(Dates,">="&B15,Dates,"<=" &EOMONTH(B15,0))
Where Dates is the Named Range containing your list of dates, and B15 contains your month/year formatted first of the month date.
If your months column is not the first of the month, then a minor change is all that is needed to convert the first criteria to the first of the month:
=COUNTIFS(Dates,">="&DATE(YEAR(B15),MONTH(B15),1),Dates,"<=" &EOMONTH(B15,0))

How to select the last day of selected months in daily data in EXCEL

I have daily data from 01-Jan-2005 till 29-Dec-2017. I want for each year to select the last day of March, June, September, and December, alongside their respective data. Part of the data:
Date Variable
30-Mar-2005 1.2943
31-Mar-2005 1.2964
1-Apr-2005 1.2959
4-Apr-2005 1.2883
5-Apr-2005 1.281
I.E: For 2005, I want the dates of 31-March-2005, 30-June-2005, 30-September-2005, and 30-Dec-2005. Desired output:
Date Variable
31-Mar-2005 1.2964
30-Jun-2005 1.9859
30-Sep-2005 1.2233
30-Dec-2005 1.2814
I currently have the build in excel formulas (i haven't installed any other plug-ins etc).
More specifically: on the left i have the data, and on the right the desired output.
Not sure if this is going to work to you, but anyways.
Looks like you always look at the last day of months March, June, September and December on a specific year (in example, 2005).
But you are not looking for the last natural day of each month. You want the last day of each month that appears in your data (in example, that explains why you use 30 december 2005 instead of 31, because there is no 31).
In Excel, dates are numbers. The more you go in the future, a bigger number is related. Knowing this, you can get the date for each month just looking the MAX value of a range of dates.
But first, you need to define the range of dates, using 2 conditions:
Month of date must be March, June, September and December
You want dates for a specific year (in example, 2005).
To get this, you need an array formula. My formula gets the max day of a specific month and year. To test it, in my Excel I did a dates series, starting in 01/01/2005 and done in 31/12/2017. I deleted manually 31/12/2005 because that date has no data.
In cell I4, just type the year you want to check. The formula will get he last day of months March, June, September and December of that year.
My array formula is:
=MAX(IF(MONTH(IF(YEAR($A$4:$A$4750)=$I$4;$A$4:$A$4750))=3;$A$4:$A$4750))
IMPORTANT!: Because it is an array formula, you will need to type it
as usual, and then, instead of pressing Enter press
CTRL+SHIFT+ENTER
You need 4 times this formula. Just change the 3 (March) for the number of the month you need (6,9 and 12).
Now that you have the dates, you just need a VlookUp to get the value you want.
=VLOOKUP(G5;$A$4:$B$4750;2;false)
If I change the year value, i get those new values:
If you want to check the file. I uploaded an example to Gdrive, so you can download if you want.Download
Anyways, try to adapt this formulas to your needs.
I converted a list of Euro conversions into a Table and used structured references. But you can use normal range references if you prefer.
In some other table, enter the following formula, where $A$45 refers to the first quarter ending date in your data table.
F2: =IF(EOMONTH($A$45,(ROWS($1:1)-1)*3)>MAX(Table1[Date]),"",LOOKUP(2,1/(EOMONTH($A$45,(ROWS($1:1)-1)*3)>=Table1[Date]),Table1[Date]))
In the adjacent column, enter the formula:
G2: =IFERROR(VLOOKUP(F3,Table1,2,FALSE),"")
And fill down until you get blanks.
(in my sample table, the last date is 1/27/2006 so the last included "End date" is 12/30/2005, there being no data for 12/31/2005)
So, there are two cases
When you have the exact last days of the month. (Its simpler).
I had a fortnightly data. I adopted this simple and innovative method. From all the dates, I first extracted the day using Day() function. for example, Day(A1). (Remember, while doing this, do not delete your original date column. Do it in a separate column as this would help you match the dates later).
Then I sorted the data using the Day column, just constructed before, in decreasing order. This would place all end dates at first. And then deleted the starting dates which were at bottom. So, now I am left with only end dates but obviously months are not in order.
So, create another column extracting just the month and year from the original date column using =MONTH(A1) & "/" & YEAR(A1). Sort the data using this column. And, you are good to go!
When you do not have the exact last days, but maximum dates like the one shown above in picture.
In this, while deleting the initial dates, you would have to take care of which date on-wards you need to delete.
For example, I deleted day 17 on-wards of months with 31 days (including day 17) and day 16 on-wards of months with 30 days (if present) because if there was this date, suppose, 18 April 2018, then this would be the last day of the month as I had a fortnightly data.

How to convert a list of text with dates and purchases into a table that shows purchases for every date with Excel VBA?

I am trying to convert a list of text into a table that shows all the purchases for a particular date.
The data looks like this, and it is all in one column:
The data follows the format of:
Job Number
Price
Date
Email of customer
Product code
I am trying to convert the data into a table which will end up looking like this:
I would like to see all the purchases listed below the dates.
Is this possible with VBA in Excel?
I found an extremely inelegant solution to the problem, but without VBA.
Here is the original column of data:
[orginal data]
In order to separate the dates into a separate column, I used this formula in column B:
=IF(AND(ISNUMBER(A2),A2>40000),MONTH(A2)&"/"&DAY(A2)&"/"&YEAR(A2),"")
If you convert the date into a number, it will be greater than 40000, and since the purchases do not exceed 400000, we can see that all numbers greater than 40000 will be a date. Since the date includes the specific time of day, and we are only looking for the actual day, I used the MONTH, DAY, and YEAR questions to select only the date.
Next, I wanted to line up the purchases with the respective dates for the orders, so I used this formula to check to see if the value in column A is a number, and if it is, copy it over to column C.
=IF(AND(ISNUMBER(A1),A1<40000),A1,"")
The formula was placed in C2 so that it lines up the purchases with the dates.
The spreadsheet now looks like
this.
Next, you select columns B and C and create a pivot table- problem solved!

Resources