Excel date conversion and grouping - excel

I have 20 years of week dates and their corresponding values. The date format is yyyy-mm-dd (the data is not in date format but just in this format on excel), and each of this has a corresponding value. I need to find daily, weekly, monthly, yearly averages. Since the data is too big and I can't find them manually.
Is there any way I can first convert this non-western type of date into some date types and then use some excel functions to do my calculation?
Thanks

If yyyy-mm-dd is text you should be able to convert to number by entering 1 somewhere and copying that, then selecting all the text to be converted and Paste, Paste Special..., check Multiply, OK.
You don't mention what you are averaging (a total divided by number of days/weeks/months/years involved?) but if just counting by day/week/month/year then a PivotTable should be very useful (dates for ROWS and Sum of values for VALUES), with grouping of rows to suit.

Related

I do separate the date-time data type into different columns in excel?

My data is in the format of yyyy-mm-dd hh:mm:ss a.m (or p.m). What I need to do is separate the date and time into 2 separate columns in excel
Dates are always stored as integers in Excel's memory. So you need to use these 2 formulas
eg: Cell - A2 has your date i:e : 14/10/2022 11:52:00 AM
Formula-1: A3=int(A2)
Formula-2: A4=A2-int(A2) #Fromat this column as Time
Cheers :-)

Change a four digit number to a year in Excel

I have a dataset that I'm working on. The dataset has a column with four-digit numbers. (1960, 1961,...2010)
I'm experimenting with the dataset in Power Query and I noticed that Power Query doesn't recognize the column as a year. Whenever I click on the column header and change the format to date, the numbers all change to 1905.
So, I tried to open it in Excel and change the formatting in it.
a screenshot from Excel
First, I tried to change the format to a yyyy date but the numbers turn to 1905.
I thought that maybe excel recognize the content of the columns as text so I tried to convert the text to a value in two ways (through the value() function and through multiplying the numbers by 1 then copying and pasting them as values) but whenever I change the format to a yyyy all the numbers change to 1905.
I tried the Text(,"YYYY") and it didn't work.
I tried to add a 01-01 to the column cells but it didn't work.
How can I let Excel or Power Query know that this column has years in it?
Any help will be appreciated.
Excel stores dates as serial numbers with 1=1-Jan-1900 So if you convert a number like 2000 to a date, Excel will add that number of days to 1-Jan-1900 and display the appropriate date. There is no way for Excel to know that you expect the Integer 2000 to be translated to a year.
In Excel, to translate that to a year, you can use a formula in an adjacent column =DATE(A1,1,1) => 1-Jan-2000
In PQ, you can also add a custom column with the formula =#date([year],1,1) where year is the name of your column with the year numbers, and the year column has Int64.Type or whole number

Excel Date Filter not grouping dates

I am pulling data from another spreadsheet and have a filter on the column header. The dates range from 2015 to 2018 off all months, weeks and days. Some of the dates are not grouping e.g. 15/03/2018 is loose underneath the 2018, 2017, 2016 and 2015 collapsible boxes.
All dates has come from the same source spreadsheet and the Marco formats them all as did/mm/yyyy when copying over.
Highlight the dates, and go to data -> Text to columns -> OK
Worked for me
I have found the formula DATE(YEAR(a1),MONTH(a1),DAY(a1)) will translate both strings that look like dates and actual dates into a date format.
Filtering and sorting behavior should then be consistent down the column.
I solved a similar problem by copying the column to notepad, and reinserting it. After this all dates were in the same format.
Make sure Excel recognizes the whole column as a set of dates.
Grouping requires all cells to be formatted as dates. Grouping will only work if there are no empty or text cells in a range and all cells have the same date format.
You may try the following steps to correct number format in the range:
remove any number formats (Home -> Clear -> Clear Formats...). After this step your date values shall look like numbers (e.g. 43284, 43285 etc.)
(optional) multiply the whole range by 1 (Copying "1" from a single cell and using "Paste Special"). This step effectively converts all cell formats to numeric
(optional) use filter to check if there are any empty / text cells left and fill them with numeric values (e.g. zeroes)
finally, apply the date format (Home -> Number -> Long Date)

Formula to convert a cell formatted in MM/DD/YYYY , to numeric month.

Is it possible to convert the standard excel format (MM/DD/YYYY) to just the month? I have column B that has a date format &column V where I have the month. I have check the internet/stack overflow, but have only found conversions for changing the format of the date.
you mean like the MONTH() formula?:
=MONTH(B1)
If the date is stored as an excel serial, to display just the month without losing the potential other information such as year, day, and time that might be stored with it, you are usually better off reformatting the display of the cell.
If you set the format of the cells to General and the numbers change you know you have your date in an Excel format. If they do not change you have them as a string.
Select custom format for the cell format and go to the area when your can type in display formats and set it either to
m or mm - for numbers to be displayed. The later will give you a proceeding 0 for single digit months.
mmm - for the first three letters of the month.
mmmm - for the full spelling of the month.
If you need to make comparisons of the month from a full date, use the formula macro man listed in a manner like:
=Month(B1)=Month(V1)
That will display true if the months for the dates in both A1 and V1 are the same.

Excel average values in time step

I have a problem with analyzing data measurement in Excel. Here is my issue.
In column A input is time (day.month hour), in column B it is day in year. From column C to I are numbers from measurement analyzer.
As you can see from the Excel Prnt Scrn, in single day we measured values in different time. I have to calculate average of all values (from value 1 to value 7) for specific day.
Example: average of values in Time 1.1.2012 (average values 1.1.2012 at 0:59, 1:59, 2:59 ….).
The problem is that I have more than 9000 rows with different time steps. I tried with Filter function, but I only manage to get time from older to newest!
Appreciate for any useful advice.
First, assign a value for all cells in the Day column using the Date number type. You will need to use Find and Replace to change all the "." to "/" in your Time column for this to work (i.e. DD.MM.YY HH:MM becomes DD/MM/YY HH:MM). Copy the Time column into the Day column. Highlight the Day column, right click, and select Format Cells. Change the format to Date, and it will cut off the time values. If you want a number for Julian Day and not the date, insert a new column and see this article for calculating day of the year: http://inanecoding.co.uk/2012/10/converting-excel-date-to-julian-day-of-year-number/
Second, use the Subtotal function under the Data tab to average each day's values. The this will work with date or Julian Day (or any column containing more than one unique value). This will change the appearance of the sheet but all the base data will still be there. However, for convenience of switching between raw and averaged data, I'd make a copy of the sheet before proceeding. Click Subtotal and in the dropdown menu "For each change in:" select which column (Date or Day) you want to use as a grouping. For the "Use function" menu, select Average. Below, check the columns you want to find averages for (Value 1-7). Click okay.
Since you have 9000 records, this may take a few seconds. Play around with the 1,2,3 boxes in the upper left corner to see the level of detail you want in the resulting spreadsheet.

Resources