sumif (data was entered on a monday) - google-sheets

I'm trying to have a function in Google Sheets that adds up values from a range if the were entered on a Monday. This is what I have right now, but it adds up to 0 all the time:
=sumif(B6:B20, WEEKDAY(2),C7)
Can someone tell me how to determine what day of the week a number cell was added on, and then add up all the numbers added on that day so I can put the sum in a different cell? (For example, the numbers in the range were added on various days of the week, and I want to add up all the numbers that were added on Monday)

Assuming column B is the column to sum and column C has the dates try:
=sumproduct(weekday(C2:C) = 2,B2:B)

Related

Google Sheets date calculation

Is there a way to take a date in one row and auto calculate another date in another column 10 days out?
ex: (column a) 12/11/20 -auto calculate the date 10 days from then
and put in (column d) 12/21/20.
So anytime I enter a date and need the 10 day out date it just auto calculates so I don't have to keep entering the date over and over again.
This is possible by using ARRAYFORMULA().
ARRAYFORMULA enables the display of values returned from an array formula into multiple rows and/or columns and the use of non-array functions with arrays.
Try this: =Arrayformula(TO_DATE(IF(A1:A="","", A1:A+10))).
Example:
Reference
Arrayformula()

In Google Sheets, how to check if Cell A (Date) is within the Date range of Cell B and C

I have a sheet with a timeline that shows a month per row in column A and an amount in USD next to that month in column B.
I want to be able to specify amounts in column G with a start and end date for that amount in columns E and F.
What I am trying to achieve is that the values in column B are automatically calculated by looking at the start and end dates specified in columns E and F and then taking the corresponding value from column G if the date in column A falls in between the date range specified in E and F.
I have found many suggestions for similar problems online but wasn't able to get any of them to work for my specific case. Any help is very welcome
You could do it as an array formula like this:
=ArrayFormula(mmult((text(indirect("A2:A"&count(A2:A)+1),"YYMM")>=text(TRANSPOSE(indirect("`E3:E"&count(E3:E)+2)),"YYMM"))*(text(indirect("A2:A"&count(A2:A)+1),"YYMM")<=text(transpose(indirect("F3:F"&count(F3:F)+2)),"YYMM"))*transpose(indirect("G3:G"&count(G3:G)+2)),(INDIRECT("G3:G"&count(G3:G)+2)+2)^0))
The idea is to develop a 2D array where the rows are the months and the columns are the amounts for matching time periods. Then use the standard Mmult method to get the row totals of the array.
Using indirect for the ranges makes the formula longer but using full-column references would be slow as it would result in a nearly 1000 X 1000 array for a default-sized sheet.
EDIT 1
Or shorter
=ArrayFormula(mmult((text(indirect("A2:A"&count(A2:A)+1),"YYMM")>=text(TRANSPOSE(indirect("E3:E"&count(E3:E)+2)),"YYMM"))
*(text(indirect("A2:A"&count(A2:A)+1),"YYMM")<=text(transpose(indirect("F3:F"&count(F3:F)+2)),"YYMM"))
,INDIRECT("G3:G"&count(G3:G)+2)))
because you can combine the row totals step with multiplication by column G.
EDIT 2
Alternatively you could just employ a much simpler pull-down formula using SUMIFS:
=ArrayFormula(sumifs(G$3:G,eomonth(E$3:E,-1)+1,"<="&A2,F$3:F,">="&A2))
This uses Eomonth to change all the start dates to the first of the month so they can be compared to the dates in column A correctly. The formula still has to be entered as an array formula because of the Eomonth calculation.
Note
The equivalent pull-down formula to the original array formulas above would be
=ArrayFormula(sumifs(G$3:G,text(E$3:E,"YYMM"),"<="&text(A2,"YYMM"),text(F$3:F,"YYMM"),">="&text(A2,"YYMM")))
but this gives zero for all rows - the reason for this is not obvious to me at time of writing.

Min Custom formula for monthly expenses spreadsheet

I have a sheet with this table as an example:
What I want to do is a formula that displays the lowest value from today until the last day.
Example: If today is the first day, the lowest value (column "Current") until the end of the table is $50 (day 2).
But if today is day 3, for example, I want the cell to display the lowest value from day 3 until the last day, in this case, it would show value $450 at day 4, ignoring all the previous values before day 3.
Is this possible?
D4:
=MIN(C4:$C$10)
Drag fill down
I could find in a forum how to use matrix to calculate:
{=MIN(IF(days>=DAY(TODAY());values))}
Where days and values are named ranges.

How can I highlight cells in Google Sheets if current month?

How can I highlight cells in Google Sheets if current month?
The cells have Jan-2017, Feb-2017 etc. and not dates.
I just want the current month highlighted so that the rest of the team can keep track of our monthly stats.
I'm supposing the column that has the months is A, and that the actual values of each cell is the first day of each month (so 2/1/2017 for February for example).
Select where you want the conditional formating to go, and open the conditional formatting sidebar.
Choose "Custom Formula" from the dropdown, and paste the following in:
=$A:$A=(today()-day(today())+1)
What we are doing here is:
=A$:A$ - Look in column A for the following
today() get todays date
-day(today()) get the day and subtract it from the today in the previous point
+1 add 1 to the result because 2/8/2017 - 8 = 2/0/2017, which google sheets actually recognizes as 1/31/2017, so by adding 1 it will become 2/1/2017 which is what is wanted.
The result of this sum is then compared to the data found in A$:A$ and the results which match the sum (today()-day(today())+1) are highlighted.
Just for the record, this may work as well using conditional formatting's custom formula:
=month($A:$A)=month(today())
Considering the dates are in the column A

Google Sheets: Compare this month's sales to last month's sales over same number of days

I'm sure this is doable and I'm just not finding the solution in the documentation, so big thanks in advance for your help. I want to calculate sales growth month over month.
For example, I'm posting this question on 10/22/2014. Calculating sales thus far for this month is easy, but I also need to know what sales were for the first 22 days of LAST month.
I already have a column containing the values for each day this month, and another column containing the values for each day last month. All I need to do is a way to sum the values for the first 22 days of last month.
Column AH = A list of the dates for last month: 9/1/2014, 9/2/2014...
Column AI = A helper column containing only the DAY of the month of the value in Column AH: 1,2,3,4...
$AJ35 = The day of today's date =DAY(TODAY())
Column AN = The numbers I want to (conditionally) sum
Why won't this formula work?
=SUMIF(AI1:AI34,"<=$AJ35",AN1:AN34)
It calculates a sum of 0.
If I take out the comparison ("<=$AJ35") and manually insert a number, it works fine:
=SUMIF(AI1:AI34,"<=22",AN1:AN34) returns a value of 362, as expected.
That is because you have put a cell reference inside a string (surrounded by double quotes)
which means that google is trying to compare against a literal string "$AJ35"
you have to concatenate the cell reference and the operator like so:
=SUMIF(AI1:AI34,"<=" & $AJ35,AN1:AN34)

Resources