Excel Formula to total amount quarterly in date row - excel

I am trying to calculate the difference between total current quarter and total previous quarter in Excel. The data is at the row title and the quarter month is not standard. For example January is consider as quarter 4 and February is quarter 1. Also date can change from one report to the next.
This is the sample data:
I want to add a formula in column H that total all amount in Q4 (Nov-Jan) and in column I the total amount in Q1 (Aug-Oct) for every row. Next month report column G will be February and I need a formula that dynamic enough to know the current quarter amount to be placed in column H.
I was thinking about using sumproduct and choose but Excel does not like it:
=Sumproduct(--((CHOOSE(MONTH(B29:G29),4,1,1,1,2,2,2,3,3,3,4,4)=4),B30:C30))
If this formula can work, I can just copy paste it to the remaining row in column H and I.

Based on above example use:
=SUMPRODUCT(--(1+MOD(INT((MONTH($B$29:$G$29)-2)/3),4)=RIGHT(H$29,1)*1),$B30:$G30)

With this array formula at H30 would do what you want and you can copy paste in I30 and in the rows down. It will work also if you add columns for Q2 and Q3.
H30 -->
=SUM(IF(CHOOSE(MONTH($B$29:$G$29),4,1,1,1,2,2,2,3,3,3,4,4)=INT(RIGHT(H$29,1)),$B30:$G30))
Ctrl+Shift+Enter
Notice it takes the quartile's number from the row above, it fixes the columns and parametrizes with the row.

Related

Inserting a value every after every nth week

I have a sample data like this:
I want to insert number 1 in 'Identifier' column every 12 weeks BUT counting these weeks from every value equal to 1 in 'Flag' column. So if a the value is 1 in 'Flag' column on 26.1.2021 then we count 12 weeks from there and insert 1 in 'Identifier' column (week 20.4.2021), and so on.. Any formula that can do the job?
You could just write =B2 in cell C14 and drag down.
A bit more sophisticated, starting in D2:
=IF(ROW()>ROW(A$1)+12,INDEX(B:B,ROW()-12),0)
and drag down
or in Excel 365 you could use a spill formula:
=IF(ROW(A2:A28)>ROW(A1)+12,INDEX(B:B,ROW(A2:A28)-12),0)
always assuming your dates in the first column are going up in regular steps of one week.

Sum based on dates on multiple column in Excel

1 st column date and 2nd column amount 3rd column date and 4th column amount .. is going on.
I want to sum based on date, If date between 2019 to 2020, i need sum the amount.
I was able to get the function SUMPRODUCT to work, assuming I understand what you want to do. (I think you want a billings total for each year, is that right?)
See this ExcelJet article on SUMPRODUCT.
There's probably a way to make this even shorter, but here's one solution:
See screen clip (I'm not allowed to post images yet.)
Formula for cell C6: =SUMPRODUCT(--(YEAR(B$3:B$4)=2019),C$3:C$4)
Copy that into cells E6, G6, I6, K6, and M6. The column references will adjust.
This will give you the 2019 totals for each of the 6 periods in row 6.
Formula for cell C7: =SUMPRODUCT(--(YEAR(B$3:B$4)=2020),C$3:C$4)
Copy that into cells E7, G7, I7, K7, and M7. The column references will adjust.
This will give you the 2020 totals for each of the 6 periods in row 7.
Formula for cell N6: =SUM(B6:M6). This is the 2019 total (the sum of row 6).
Formula for cell N7: =SUM(B7:M7). This is the 2020 total (the sum of row 7).

Calculate SUM based on date

This is driving me nuts and I don't know what I'm doing wrong.
I have an excel table where my turnover is in with the date of incoming invoices. The date is in format ddmmjjj and is in column C.
I want to calculate my turnover on my dashboard. The total turnover is in column G.
The formula I use is:
=SUM(IF(MONTH(Sheet1!C:C)=2;Sheet!G:G;))
But this formula keeps giving me the total turnover... What am I doing wrong?
You need to use the SUMIF function in Excel, which allows you to sum up certain cells if the values in associated cells match a criteria:
SUMIF(range, criteria, [sum_range])
In your case, you'd want to extract the month for the dates in column C into another column (say column X holds the month for the dates in column C), and then:
=SUMIF(Sheet1!X:X, 2, Sheet1!G:G)
The formula you are using is correct, however you need to enter it as an array formula (via Ctrl + Shift + Enter).
=SUM(IF(MONTH(Sheet1!C:C)=2,Sheet1!G:G,0))

Breakeven for Excel

I would like an excel formula for the below. For each month (columns) I have a total (all in same row). I want to sum the range of totals and highlight the month in which the cumulative sum of months turns positive. These totals will change based on other variables.
Columns = A1 through L1 (months)
Totals in row B for each month
Assuming your cumulative total will be in row 3, in A3 you would put the formula:
=SUM($A$2:A2)
note the dollar signs in the first part of the range. When you now copy it down the row the second part will change creating a cumulative sum of the total values.
To highlight the first positive value you would select the whole range of cumulative values (say A3:X3) and create New Rule for conditional formatting, select "Use a formula to determine which cells to format", and place the following formula as the condition:
=A3=MIN(IF($A$3:$X$3>0,$A$3:$X$3,""))
Which will highlight the lowest non negative value in your row with the formatting you select. Hope this helps. Regards,

Count number of occurrences by month

I am creating a spreadsheet with all my data on one sheet and metrics on the other.
On sheet 1 in cells A2:A50 I have the dates in this format (4/5/13). On sheet 2 in cell E5 I have April and I want it to total the number of PO's created in F5.
How can I do this?
I have tried using
=COUNTIF('2013'!$A$2:$A$50,'2013 Metrics'!E5).
I have a feeling that since my range is in 4/5/13 format and my criteria is April that won't work.
I was able to use this formula for total spend by month:
=SUM(IF(MONTH('2013'!$A$2:$A$19)=4,'2013'!$D$2:$D$19,0))
but not luck with how many PO's by month.
Use a pivot table. You can manually refresh a pivot table's data source by right-clicking on it and clicking refresh. Otherwise you can set up a worksheet_change macro - or just a refresh button. Pivot Table tutorial is here: http://chandoo.org/wp/2009/08/19/excel-pivot-tables-tutorial/
1) Create a Month column from your Date column (e.g. =TEXT(B2,"MMM") )
2) Create a Year column from your Date column (e.g. =TEXT(B2,"YYYY") )
3) Add a Count column, with "1" for each value
4) Create a Pivot table with the fields, Count, Month and Year
5) Drag the Year and Month fields into Row Labels. Ensure that Year is above month so your Pivot table first groups by year, then by month
6) Drag the Count field into Values to create a Count of Count
There are better tutorials I'm sure just google/bing "pivot table tutorial".
For anyone finding this post through Google (as I did) here's the correct formula for cell F5 in the above example:
=SUMPRODUCT((MONTH(Sheet1!$A$1:$A$50)=MONTH(DATEVALUE(E5&" 1")))*(Sheet1!$A$1:$A$50<>""))
Formula assumes a list of dates in Sheet1!A1:A50 and a month name or abbr ("April" or "Apr") in cell E5.
Make column B in sheet1 the dates but where the day of the month is always the first day of the month, e.g. in B2 put =DATE(YEAR(A2),MONTH(A2),1). Then make E5 on sheet 2 contain the first date of the month you need, e.g. Date(2013,4,1). After that, putting in F5 COUNTIF(Sheet1!B2:B50, E5) will give you the count for the month specified in E5.
I would add another column on the data sheet with equation =month(A2), then run the countif on that column... If you still wanted to use text month('APRIL'), you would need a lookup table to reference the name to the month number. Otherwise, just use 4 instead of April on your metric sheet.
use count instead of sum in your original formula u will get your result
Original One
=SUM(IF(MONTH('2013'!$A$2:$A$19)=4,'2013'!$D$2:$D$19,0))
Modified One
=COUNT(IF(MONTH('2013'!$A$2:$A$19)=4,'2013'!$D$2:$D$19,0))
AND USE ctrl+shift+enter TO EXECUTE
Recommend you use FREQUENCY rather than using COUNTIF.
In your front sheet; enter 01/04/2014 into E5, 01/05/2014 into E6 etc.
Select the range of adjacent cells you want to populate. Enter:
=FREQUENCY(2013!!$A$2:$A$50,'2013 Metrics'!E5:EN)
(where N is the final row reference in your range)
Hit Ctrl + Shift + Enter
Sooooo, I had this same question. here's my answer: COUNTIFS(sheet1!$A:$A,">="&D1,sheet1!$A:$A,"<="&D2)
you don't need to specify A2:A50, unless there are dates beyond row 50 that you wish to exclude. this is cleaner in the sense that you don't have to go back and adjust the rows as more PO data comes in on sheet1.
also, the reference to D1 and D2 are start and end dates (respectively) for each month. On sheet2, you could have a hidden column that translates April to 4/1/2014, May into 5/1/2014, etc. THen, D1 would reference the cell that contains 4/1/2014, and D2 would reference the cell that contains 5/1/2014.
if you want to sum, it works the same way, except that the first argument is the sum array (column or row) and then the rest of the ranges/arrays and arguments are the same as the countifs formula.
btw-this works in excel AND google sheets. cheers

Resources