Inserting a value every after every nth week - excel

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.

Related

On Excel is it possible to apply a certain formula after a new date is written on another cell?

I would like to apply this formula =SUMIFS(K:K;A:A;A3) on a cell on a column only after a change in the date for example:
On this image the 14/12 a sum is calculated 2 times while I would love it if only on sum would calculate for each day. Is this possible maybe add a check weather whats MAX day?
Use =IF(COUNTIF(A$1:A3;A3)-COUNTIF(A:A;A3)=0;SUMIFS(K:K;A:A;A3);"") in the same row # as A3
The 1st countif is a counter from the first row up to the current row meeting the condition.
The 2nd countif is a counter of total occurances of the condition.
If 1st minus 2nd equals 0 it'll show your sumif formula, else it shows blank.

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).

How to extract the first non-blank cell data (numbers) and continue the extraction, first, second, third, etc from a column, and extract to a row

visual I need the formula to start looking from the top of the column list of revenues and find the first cell that has number data in it, and the second, third, forth and so on, until 60th. This data then needs to be displayed in a horizontal row. Month 1, Month 2, and so on.
In this case, it will put the number data from October into Month 1 on the row at the top. It should continue with November as Month 2.
I should mention, this starting point will change, This time is October, next time it can be any other month that will begin as Month 1
I've tried some code which worked initially but when I tried to move the reference cells to find my data, it stopped working. Been at this for 2 days, need help.
Thank you to all the smart folks out there...much appreciated.
If I understood your problem correctly, here's a solution:
Cell F2: {=INDEX($A$2:$A$38,MATCH(FALSE,ISBLANK($C$2:$C$38),0))} enter with ctrl+shift+enter
Cell G2: =F2+1 drag it until the last column
Cell F3: =INDEX($B$2:$B$38,MATCH(F$2,$A$2:$A$38,0)) drag it until the last column
Cell F4: =INDEX($C$2:$C$38,MATCH(F$2,$A$2:$A$38,0)) drag it until the last column
I'm assuming there are no blank cells after the first non-blank.
Edit: if there are zeros instead of blanks, use this on F2:
{=INDEX($A$2:$A$38,MATCH(FALSE,INDEX($C$2:$C$38=0,),0))}
I'm guessing that the values in Jan-Sep are actually zeroes and the hyphen comes from a accounting style number format.
If the word Month in the green cell is B2 put this into the cell under Month 1 and drag right.
=index(c:c, aggregate(15, 7, row($3:$99)/($c$3:$c$99>0), column(a:a)))

Excel Formula to total amount quarterly in date row

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.

Find cells containing not null value between date range in Excel

I have a table where Column A is a list of every day this year. In column E I have hours worked on each given day. Some of these cells are blank for days not worked. Because I've also entered work hours on some weekends, it's important I isolate the weekdays in this query
I need to know the number of WEEKDAYS from column A between the start date (A2) and TODAY where there IS A VALUE in column E.
In other words the number of NETWORKDAYS between A2 and TODAY where the value in column E is NOT NULL.
If you use Josh's suggestion but use a slight variation, e.g. in F2 copied down you can use this formula
=WEEKDAY(A2,2)
Using that version Saturdays = 6 and Sundays = 7 so to count weekdays so far this year with hours in column E you can then use COUNTIFS like this:
=COUNTIFS(A:A,"<="&TODAY(),E:E,"<>",F:F,"<6")
......or it's possible to do the same without a helper column (column F) if you use SUMPRODUCT, e.g.
=SUMPRODUCT((A2:A400<=TODAY())*(WEEKDAY(A2:A400,2)<6)*(E2:E400<>""))
The quickest way to do this is to add a column in which each cell is =WEEKDAY(A2), all the way down. This will give you the day of the week. Then just filter your data: assuming your weekend is Saturday and Sunday, filter out 1 and 7 in the 'weekday' column, then filter out blanks in Column E, and then just select Column A and the COUNT (number of cells) will be displayed in the bottom right corner.

Resources