Excel formula based on previous month - excel

I inherited a worksheet that has a number of formulas (see below). The formula is trying to pull the rate from the previous month but once the month changes the amount is 0, so the current month = 0. Surely there must be a better way to write this formula but I'm stuck. Any suggestions would be greatly appreciated. Thanks for your help.
Jan 500
Feb =IF(MONTH(TODAY())=2,x7,"0")
Mar =IF(MONTH(TODAY())=3,Y7,"0")
Apr =IF(MONTH(TODAY())=4,Z7,"0")
May =IF(MONTH(TODAY())=5,AA7,"0")
Jun =IF(MONTH(TODAY())=6,AB7,"0")

I think what you need is to just check to see if today's date is less than the month you are evaluating for.
This may be what you are looking for:
Feb =IF(MONTH(TODAY()) < 2,0,x7)
March =IF(MONTH(TODAY()) < 3,0,y7)

Related

How to use excel formula to proportionately distribute data

I am working on a task where i need to automate the calculation using formula in excel.
Below is the table;
Column A shows the hierarchy - Month(June) -> Week No(9,10,11,12,13) -> Days in respective Week(Mon - Sun)
Column B is sales. and Column C is the percentage break down.
I want to modify existing percentage break down in a new column in a way so that
more weightage is assigned to Thursday, Friday and Saturday and Sunday.
take out some percentage from Mon, Tue and Wed and assign them to Thu, Fri, Sat and Sun.
New percentage should should add up to respective weeks percentage.
Below is the formula i used;
=IF(A81="Mon",C81-0.005,IF(A81="Tue",C81-0.005,IF(A81="Wed",C81-0.005,IF(A81="Thu",C81+0.003,IF(A81="Fri",C81+0.004,IF(A81="Sat",C81+0.006,C81+0.002))))))
Challenge arises when weekdays are split between 2 months. For example, if you look at week 9(Jun) - it starts from Wed while Mon and Tue are part of May.
Here is the outcome I got with current formula;
In calculated field sum of new percentage(17.99%) is not same as earlier(16.99) which is wrong.
Can you please help me create a formula which takes care this challenge and fulfil other conditions as well.
I would really appreciate your help.
Thanks.

Excel - count a specific value based on a part of another cell

I thought this would be a no brainer. But I really need help to solve it.
I have a row of dates: 10 july 2020, 11 july 2020 and so on (Swedish excel).
Below each date are strings for example "FP". I wish to achieve a counter for each "FP" that is below a specific month of a year, such as july 2020.
The way I approached this was with
=COUNTIFS(G1:UG1;"*july 2020";G2:UG2;"FP")
However the * doesn't do what I want it to. Is there another way to do this?
Please help! :)
The dates are true dates and as such the july 2020 is just a format of a number and not actually there.
Instead BookEnd the date:
=COUNTIFS(G1:UG1;">="&DATE(2020;7;1);G1:UG1;"<"&DATE(2020;8;1);G2:UG2;"FP")

Finding MTD, QTD, and YTD in excel from monthly returns

I've been working on this for awhile and can't seem to find an appropriate way to code this.
Goal: Take a list of monthly returns that currently spans over three years (this is an automated list so it will keep adding months) and find MTD, QTD, & YTD using function so I can automate the process.
Problem: I've tried the OFFSET function, different versions of COUNT, IF statements and can't find a way to properly code the function.
NOTE: this is for stock data/earnings report
Just to clarify, I know how to do this manually, but want to automate the process :) Would be more than happy to use VBA but would like to stick to a simple function if possible...
I'd be more than happy to email the WS to someone. Thanks so much!!
If you want to keep it simple and avoid vba here is a suggestion
The manner in which the data sheet is presented matters.
I assume months go down, with there only being 1 column for 'monthly returns'?
On a separate area/worksheet, set up the months with a value for what they are in the column next to them. Ie
Jan 1
Feb 2
Mar 3
Apr 4
...
Dec 12
then have a drop down where you can select what month it is.
so if it is Jul, you can select Jul.
From here, do a vlookup/indexmatch to pull the number for the month through, so Jul would be 7
From here the MTD is easy.
Do an offset from the beginning of the year to the current month
=offset ([start point],[month number],[columns])
=OFFSET($D$1,$C$21,0)
start point will be one row above Jan, that way when Jan is chosen it will fall onto Jan.
Month number you will get from what was said earlier
and columns will depend on how you place it
YTD, you will do the same as above but have a sum
so
=sum(B3:offset ([start point],[month number],[columns]))
=SUM(D2:OFFSET($D$1,C21,0))
QTD would be easiest just plotting the sums as it would never change
So set out Q1,Q2,Q3 and Q4 as prefixed ones. Then lookup to them.
However, if you want to see the most recent quarter by a formula. On the month number list add a new column which says what quarter it is. Then
Jan 1 1
Feb 2 1
Mar 3 1
Apr 4 2
...
Dec 12 4
It should the read off a formula like so
=SUM(
OFFSET([start point],(INDEX([month number table],MATCH([month],[month list],0),3)-1)*3,0):
OFFSET([start point],INDEX(month number table],MATCH([month],[month list],0),2),0))
=SUM(
OFFSET($D$2,(INDEX($F$2:$H$13,MATCH($C$20,$F$2:$F$13,0),3)-1)*3,0):
OFFSET($D$1,INDEX($F$2:$H$13,MATCH($C$20,$F$2:$F$13,0),2),0)
)
What you are doing is to find the month at the beginning of the quarter and then sum to the current month.
Regarding this bit at the end
OFFSET([start point],(INDEX([month number table],MATCH([month],[month list],0),3)-1)*3,0):
You are finding the month quarter index number(1,2,3,4) and multiplying it by three. The reason you want to take away one before multiplying by three is because you want the start point of the quarter, thus in jan to march, this will be 0, and then you add a row to get the start point being Jan.
In Oct to Dec this will be (4-1) = 3. 3x3 = 9 which will be Oct to make Oct being the start point. Amend as need be.
The yellow section is what your actual information is presented as
The green section is your lookup area
The Blue area is information you are looking for with the lower bit reading from the lookup

Conditional Formulas in Excel 2013

Good day folks! Can you please help me with the following excel problem (Please see below)
July Aug Sep Oct Nov Dec
Total Assets (USD'K) 32 36 38 31
Current Month : (Drop-Down list for all months)
Monthly Change in Total Assets = Current Month - Previous Month
So, here is the situation:
Each month I need to new add statistics to my worksheet. For example, when new data for Total Assets in November arrives, I need to insert it above under the heading "Nov", etc.
After inserting new data, I need to select from the drop-down list current month (for example, "Nov").
Afterwards, "Monthly Change in Total Assets" needs to be calculated automatically. For instance, "Total Assets in November - Total Assets in October".
I assume that, I need to use conditional calculation functions. But it did not work the way I expected.
Can you please help, me. Thank you in advance for your kind assistance.
Sincerely,
Considering the layout of the data is similar to as shown in the image, try this...
In B5
=IF(COUNT(B2:G2)=0,"",IF(COUNT(B2:G2)=1,B2,INDEX(B2:G2,MATCH(B4,B1:G1,0))-INDEX(B2:G2,MATCH(B4,B1:G1,0)-1)))

Nested If And Formula in Excel

I have an excel document with various dates in Column A ranging from April, 2014 through April 2017.
I need to assign a number based on the month and year - April 2014 is 23 and it drops by 1 every month going forward. So May 2014 is 22, June 2014 is 21 and so forth. Once I get to March 2016, or 0, all dates greater than that are also 0. My issue is that excel is treating April 2014 and April 2015 the same - they are both returning a value of 23.
Here is my code:
=IF(AND(MONTH(A2)=4,YEAR(A2=2014)),"23",IF(AND(MONTH(A2)=5,YEAR(A2=2014)),"22",IF(AND(MONTH(A2)=6,YEAR(A2=2014)),"21",IF(AND(MONTH(A2)=7,YEAR(A2=2014)),"20",IF(AND(MONTH(A2)=8,YEAR(A2=2014)),"19",IF(AND(MONTH(A2)=9,YEAR(A2=2014)),"18",IF(AND(MONTH(A2)=10,YEAR(A2=2014)),"17",IF(AND(MONTH(A2)=11,YEAR(A2=2014)),"16",IF(AND(MONTH(A2)=12,YEAR(A2=2014)),"15",IF(AND(MONTH(A2)=1,YEAR(A2=2015)),"14",IF(AND(MONTH(A2)=2,YEAR(A2=2015)),"13",IF(AND(MONTH(A2)=3,YEAR(A2=2015)),"12",IF(AND(MONTH(A2)=4,YEAR(A2=2015)),"11",IF(AND(MONTH(A2)=5,YEAR(A2=2015)),"10",IF(AND(MONTH(A2)=6,YEAR(A2=2015)),"9",IF(AND(MONTH(A2)=7,YEAR(A2=2015)),"8",IF(AND(MONTH(A2)=8,YEAR(A2=2015)),"7",IF(AND(MONTH(A2)=9,YEAR(A2=2015)),"6",IF(AND(MONTH(A2)=10,YEAR(A2=2015)),"5",IF(AND(MONTH(A2)=11,YEAR(A2=2015)),"4",IF(AND(MONTH(A2)=12,YEAR(A2=2015)),"3",IF(AND(MONTH(A2)=1,YEAR(A2=2016)),"2",IF(AND(MONTH(A2)=2,YEAR(A2=2016)),"1",IF(AND(MONTH(A2)=3,YEAR(A2=2016)),"0",IF(AND(MONTH(A2)>3,YEAR(A2=2016)),"0","0")))))))))))))))))))))))))
Any help is greatly appreciated!
I would use yearfrac instead.
=IF(A2>DATE(2016,3,1),0,ROUND(YEARFRAC(DATE(YEAR(A2),MONTH(A2),1),DATE(2016,3,1))*12,0))
Yearfrac between your date (A2) and date(2016,3,1) will give you the portion of a year between the two which you can multiply by 12 and round to get the month number. The if statement takes care of months after March.
Try this:
=IF(A2<Date(2016,3,1),DATEDIF(A2,DATE(2016,3,1),"m"),0)

Resources