How to create / beautify month names in Excel? - excel

I have a time-series data collected as this :
Year Month Data
2015 1 0,92
2015 2 0,91
2015 3 0,90
and I want to plot it to have month strings like February 2015 in the x-axis.
Can I do this with an extra column with a formula before Data, or how can I do this?

Use the following as a formula (assuming year is in cell A1 and month is in cell B1)
=TEXT(DATE(A4,B4,1),"mmmm-yyyy")

Considering the language issue:
=CHOOSE(B3;"January";"February";"March";"April";"May";"June";"July";"August";"September";"October";"November";"December")&" "&A3
However, these are strings and an axis based on them will not be a time scale.

Related

Using Visual Basic to pull data from within a range to use in an Excel function

Let's say that I have a three column table/range for all of 2022: date, Day of Week, and Sales. I want to be able to calculate the average sales for a Monday, Tuesday, etc. Using Visual Basic, how would I pull sales for every Monday in 2022 into the Average() function?
As Scott mentioned, Averageif, or Averageifs to test multiple criteria.
Example of Averageif for only DoW:
=AVERAGEIF(B:B,E2,C:C)
Example of Averageifs for Dow and Year
=AVERAGEIFS(D:D,B:B,G2,C:C,F2)
Other options include pivot table
This is just a quick one:
Playing With Dates (Excel Formula)
If you have Microsoft 365, in cell F2 you could use:
=LET(MyArr,(TEXT($A$2:$A$33,"dddd")=$E2)*(YEAR($A$2:$A$33)=F$1)*$C$2:$C$33,
AVERAGE(FILTER(MyArr,MyArr<>0)))
or
=AVERAGE(FILTER($C$2:$C$33,
MAP(TEXT($A$2:$A$33,"dddd"),YEAR($A$2:$A$33),
LAMBDA(lDay,lYear,AND(lDay=$E2,lYear=F$1)))))
and copy to the right and down (F2:G8).
The days are in E2:E8 and the years e.g. 2021 and 2022, are in F1:G1.
These only use the Date and Sales columns.

Dynamic Range for Average Calculation

I am trying to come up with an Excel Formula to calculate 6 Months average value from Monthly prices.
A year is considered from April 2022 to March 2023 and so on. That means from April 2022 to Sept 2022 it is Half 1 and Oct 2022 to Mar 2023 it is Half 2.
Total time line is till March 2055. So, the formula has to be dynamic.
Please advise how I can use a formula for this averaging task.
The Data table look like below.
INPUT
Please refer the link to picture
OUTPUT
In Yellow in the picture below
Table Pic
Thank you!
It would be fairly simple if we had 'regular' half-year periods. Since half-years are shifted 3 months forward, we also need to shift the formula by three months. To achieve that, we have an OFFSET function that we can apply for the prices row. It will work fine for all the half-year periods with the exception of the first one since we'll have the prices range shifted. So, for the first half of 2022 in the cell B9 we will simply write =AVERAGE(B5:G5) and for all the rest, starting from C9, -
=AVERAGEIFS(OFFSET($B$5:$OG$5,0,3),$B$1:$OG$1,C7,$B$2:$OG$2, IF(C8=1,"<="&6,">"&6))
assuming that the months start in column B like in your example picture and finish in column OG as suggested from your task description.
If you want rolling 6mo periods, I prefer INDIRECT to OFFSET.
Assume the data runs vertically, each month is a separate row, and "X" is the cell of the latest value, this should work:
=AVERAGE(INDIRECT(ADDRESS(ROW(x), COLUMN(X))&":"&ADDRESS(ROW(X)-5, COLUMN(X))))

Excel: Finding the difference between dates

I want to find the difference in years between two dates, in two different columns.
1st column: Is the fiscal year shown as 'YYYY', e.g. 2007. This column is formatted as 'General'
2nd column: Is the year a person became CEO shown as 'MM/DD/YYYY'. e.g. 11/28/2011.
This column is formatted as date.
I want to calculate the time a person has been CEO per fiscal years, meaning the difference in the two dates in years. e.g. column 1: 2008 / column 2: 5/25/2004 / difference: 4
Thanks
Try this code:
=A1-(RIGHT(B1;4))
Assuming your year is in A2 and Date is in B2 then try this...
=A2-YEAR(B2)
And then format the formula cell as General.

Excel Running Total if data in current month

I am trying to write a formula in Excel that will compare 2015 totals to 2016 totals and projections. If there is a value in the rows for January, February, March and April, I want the 2015 sum of those same months. Then the same for the projected
Screen capture of excel file
I like to use SUMPRODUCT() for something like this:
Projected:
=SUMPRODUCT(($B$5:$B$16<>"")*$A$5:$A$16)
Actual:
=SUMPRODUCT(($B$5:$B$16<>"")*$D$5:$D$16)

How to turn column of four digit years entered in general format into a date column or yyyy simply

How to turn column of four digit years entered in general format into a date column or yyyy simply? I have a column of two digit months 1-12 and a column of four digit years and then found I should have used a date format. I would like two convert these hundreds and hundreds of entries into a useful date format with a formula or minimum of fuss or programming logic so I can perform useful analysis on the data and don't have to manually re-enter large amounts of data.
I have excel 2007
Thanks for any help
Use on of the following formulas in an unused column's row 2,
=DATEVALUE("1/1/"&A2) '<~~ 01-Jan-2015 when 2015 in A2
=DATE(A2, 1, 1) '<~~ 01-Jan-2015 when 2015 in A2
Format the cell (Ctrl+1, Number, Custom) as yyyy then fill down or right as necessary.
Do not use the YEAR function. For 2015, you will get 1905. This is because dates are 1 for every day past 31-Dec-1899 and 07-Jul-1905 happens to be the 2015th day since 31-Dec-1899.
I believe this is what you are looking for, where A1 would be the location of the cell that you have stored a four digit year as text:
=TEXT("1/1/" & A1,"yyyy")

Resources