How do I get a running total for a row I will only have partial data for?
In Column I of my example (Running Total Comparison), I would like to compare the sum of the cells I have information for in Sales Week 2 (B3:D3) with those same cells from Sales Week 1 (B2:D2). If I add data to E3, I would then need to compare the sums for (B3:E3) and (B2:E2).
For Sales Week 1,
=sum(b2:index(2:2, match(1e99, 3:3)))
For Sales Week 2,
=sum(b3:index(3:3, match(1e99, 3:3)))
You can also use this formula in cell I2, then drag it to the bottom...
=SUM(OFFSET(B2,0,0,1,LOOKUP(2,1/($B$3:$H$3<>""),COLUMN($B$3:$H$3))-1))
Related
I have an Excel sheet with monthly costs per food. The goal is, on a part sheet, to calculate the value of each food in every month. With a formula I am using at the moment =SUM(VLOOKUP (A3; Food! C3: K3000; 7; 0)), it is only looking for a relative value in the first month and not in the total of all months.
To clarify the formula:
A3 is the food I'm looking for;
Food! C3: K3000 is the range of the table where I am looking for the data;
Finally, 7 will be the column index where the amount spent per month is.
This is what I have in Food sheet:
I think there is no extra information. If something else is left, please tell me.
That's the result I want:
You can use SUMIF:
=SUMIF($B$3:$B$11;G3;$C$3:$C$11)
I have provided a simple example of what I would like to do. I tried to use AverageIf to get the average of all Monday sales for March and April but the formula only provides me the average of March's Monday sales and excludes April.
Note: Column A is Weekday number, Column B is March Sales, Column C is April Sales.
This is the formula I used:
=AVERAGEIF(A2:A200, "=" & 1, B2:C200), which only provides me with average Monday sales in column B.
How can I adjust the formula to also include April in the total average (i.e. take into account column C rather than just column B alone)
Rather than using AverageIf(), try using Average(If()) as an array formula for this kind of scenario.
In your scenario, you could use the following formula to get the average:
=AVERAGE(IF(A2:A200=1,B2:C200))
ENTERED AS AN ARRAY FORMULA using cntrl + shift + enter
Hope that helps.
I'm currently trying to create a formula that will look at two columns for a criteria and then sum up the cells next to it,
For example,
Column A Column B Column C
Date Range Type Value
01/01/2018 Credit £4.00
02/01/2018 Debit £4.00
05/01/2018 Credit £6.00
01/02/2018 Debit £5.00
01/03/2018 Credit £6.00
What i want the formula to do is look at column A for if it is greater or equal to the current month and column B equals credit, then calculate and add the cells together, so for the above example the answer would be the credit for the month,
So for the month of January the answer would be £10
So far i have tried:
=SUM(IF((W7:W28<=X1)+(X7:X28=AA2),Y7:Y28,0))
But this just does the SUM for all cells in the array
Tried:
=SUMPRODUCT(W7:W28>=X1 * X7:X28=AA2 *Y7:Y28)
But this just gives me a VALUE error unfortunatly :(
Can you please advise how i can create a formula to do a SUMIFS but with an array and equal to this month
Try the following for a January SUM:
=SUMIFS(C2:C6,A2:A6,">="&"01-Jan-2016",A2:A6,"<"&"01-Feb-2018",B2:B6,"=Credit")
The SUMIFS function is of the format:
SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
So we tell the system to sum across C2:C6 but only when
A2:A6,">=" & "01-Jan-2018" : the value in the A column is greater than 01-Jan
A2:A6,"<" & "01-Feb-2018" : the value in the A column is less than 01-Feb
B2:B6,"=Credit" : the value in the B column equals the string "Credit"
Hope this helps.
I have a spreadsheet that tracks average file processing times over the course of a month. One of the macros and stats that we like to pull, is performance on Mondays (as the files are a little built up over the weekend). The spreadsheet is organized into columns by weekdays of the month:
The dates are formatted MM/DD/YYYY, so I would think Excel has a date function that it can determine weekday based on that date value.
Currently, I just have to manually tell the Macro which columns are Mondays, like so:
=AVERAGE(B20,G20,L20,Q20)
So, instead of manually, how would I get the average over the range of say, B20 to V20, only if the day of the week is Monday (the date cells are in row 1, so B1 to V1)?
To determine the weekday of a date in EXCEL use the =WEEKDAY() formula, which evaluates as 1 (Sunday) to 7 (Saturday)
e.g. If A1 contains 12/31/2016 (or 31/12/2016 if you're from where I'm from), the formual =WEEKDAY(A1) would evaluate to 7 (indicating that the last day of 2016 was a Saturday)
To apply this formula to your problem: (assuming that the dates are in row 1 and the values are in row 2)
insert a new row to hold the WEEKDAY() value (say, row 2)
in cell A2 type in =WEEKDAY(A1)
copy this formula as far right as necessary (to include all your dates)
Your average for Mondays is calculated as =AVERAGEIF(2:2, 2, 3:3)
Possibly, you can add a column called [Day Of The Week] and use the following formula to display the day.
TEXT(B4,"dddd")
Then add an 'If'statement to your result cell.
simply
=SUMPRODUCT((MOD(B1:V1,7)=2)*B20:V20)/SUMPRODUCT((MOD(B1:V1,7)=2)*1)
should give the average of all values from B20 to V20 if the corresponding cell in row 1 is a monday.
the first part sums the values of all mondays and the second part counts them (sum / count = average) ;)
If you have any questions, just ask.
If your date is in A1, you can use =Text(A1,"dddd") to determine the day of the week (it will return the name, "Monday", "Tuesday", etc.) so then you could do perhaps:
=If(text(A1,"dddd")="Monday",[do whatever],[do whatever]) (may need a helper row/column to hold the text of the weekday)
(Or use AverageIf() and use the Text() idea.)
Assume that we are currently in the month March. I have a table with all the months and a list of products. Inside each column i have the number sales a product has made on that month, like so:
Notice i have a cell containing "Total until current month". I would require a formula to find out the total amount of sales of a specific product (product A for example) up until March (current month) as you can see with the manually typed 6, 1 in Jan and 5 in Feb.
I would usually do this by finding the sum of cell C4 and D5. But this should be 1 dynamic formula that is updating as we progress onto next month. So as an exammple, in April, it will find the sum of cell C4 - E5 (Jan - March) and update the value.
Is this possible?
Regards
Put a helper row above the month names that has the month numbers 1-12.
Then use SUMIFS():
=SUMIF($C$2:$N$2,"<=" &MONTH(TODAY()),C4:N4)
You could hide that row so it is not visible and not readily accessible.
In row 3 put month numbers. Now if in cell Q4 you have a month number that you want to relate to use:
=SUMIF($C$3:$N$3,"<"&$Q$4,C5:N5)
for sum of A and drag down for other products.
If you want to pick the product you want sum for and have it all in one cell, then assuming that in cell R4 you have your product name (e.g. "B") write
=SUM((C3:N3<Q4)*C5:N6*(B5:B6=R4))
and press ctrl+shift+enter.
The simplest solution is to leave E4 through N4 empty. Only put a value in E4 once March is complete and you have a value for March. This will allow a formula like:
=SUM(C4:N4)
for Product A