Sum current and prior year month-to-date to corresponding day of month - excel

In the picture, I have a running monthly total at the bottom for THIS YEAR. I have Last Year already populated. How can I have LY monthly total only populate to where I am currently today?

Generalising (for lack of a clear requirements statement - but conveniently then possibly of wider relevance) if you have two columns of numeric values with one (say A) of 31 entries and a column label (in Row1) and the other (say B) of 15 entries and column label and you want to add both down only as far as the shorter column is populated then you might:
In B32 enter =SUM(B2:B31) - to derive the "current month to date" total.
In A32 enter =SUM(INDIRECT("A1:A"&MATCH(1E+100,B1:B31,1))) - to derive the sum of the same rows (but different column) as above.

Related

How to calculate the daywise average and multiply it to number of rows in that particular day

I have daywise excel data of four months which contains hourly data from 10 AM to 3 PM or sometimes 10 AM to 2 PM....1PM ..... like wise it is varying. The column A contains the date, Column B contains the time and column C and D has the data which i want to average for each day and multiply it to the number of occurrence.
For example If I have a data in column C and D for 17 Oct from 10 AM to 3PM (6 Hours)..Then i want to average these hourly data for a day and multiply it by 6. Since my interval of hourly data is not fixed, that is why i want a code which can average the daywise data and multiply it to the number of occurrence. I want to average the data 1 and data 2 for each day and to multiply its average by the number of occurrence of data in that particular day
I could not exactly get what does "average these hourly data" means since Average basically means summing all data within a day and dividing them to the occurrences. If you again multiply by the number of daily occurrence, you will get the summed value again.
Apart from above unclear point, un-merging all column B cells and filling all your rows with date data will be very helpful in order to form a quick sum or average formula based on the date conditions.
After doing above step, you may enter the below formula to E2 to get the sum of Col:C, for all data dated A2; 17-Oct.
=SUMIFS(C:C,A:A,A2)
And you may get the occurences on the date of your row data, you should use the formula and copy down:
=COUNTIFS(A:A,A2)
In combination of above 2 formulas, you may calculate the averages and/or date occurrences. I may write an exact solution if you may enter your requested values into COL:E and provide a screenshot.

how to get cumulative amount of columns under certain criteria when skipping some of them

I have a question with regards to getting the cumulative amount of some columns when skipping others (please see the picture).
Lets say on a certain row we have certain type of op units for which we have 3 columns for every month (Revenue, COS, G&A). We have this for Jan, Feb, March and then 3 columns to total the amounts for quarter 1. The next 3 columns are for April.
My question is how to make formulas that can add the cumulative amount for year to date in each category while skipping the Q1 amounts. I can do with offset but I can't skip Q1 column.
You need a SUMIFS formulas that sum amounts in columns B:P for each category but exclude amounts where B1:P1 = "q1". So for YTD Revenue the formula would be:
=SUMIFS($B$3:$P$3,$B$2:$P$2,Q$2,$B$1:$P$1,"<>q1")
Copy to the right into columns R:S and then down rows as required.
Sorry, I don't think that offset /sumif will work because of 3 different criteria.
Otherwise the month I will be selecting in row 1 after end of the table (after Dec17 and Q4) there will be 3 foxed columns that will show YTD cumulative figure which should change when the month changes

i want to have a single column containing different values for each month

I have created a table in excel for keeping the leave records of staff. I created a scroll bar to scroll to a different month. I have added an extra column named "leave this month" which shows how many days a person has taken leave. but when I scroll to a different month (for example from January to February) the column's data stays the same. I want it to have different data for different months. for example for January it is 3 days, for February it is 4 days and... I want different values in the same cell for different months.(when I scroll to a different month the value should change) do you guys know how to do that?
screenshot
Sub showcalendar()
LeaveTracker.Columns("C:NJ").Hidden = True
LeaveTracker.Range(Columns(Range("B3").Value * 31 - 28),Columns(Range("B3").Value * 31 + 2)).Hidden = False
End Sub
Here is the approach I would use:
Define a spreadsheet with 31 X 12 columns (each group of 31 columns would represent a month, even for those cases when the month has 28/29/30 days); this spreadsheet will be use as the storage of the raw data (i.e. presence/absence of a person each day of the year),
A second spreadsheet to be use for display will have the cells linked to the first one with an horizontal offset (to the right) to be calculated as 31 * (month_number - 1); as such, when looking at the information of March, the offset would be 62 columns to the right.
Your scrollbar would run from 1 to 12 and set the value of the month (which would then be used to calculate the offset.
In this way, you don't need to copy-paste anything and, instead, you have a sliding "window" that runs right and left over your raw data sheet.
Hoe this description is clear.
So you basically have 365 columns for each day of the year. On row 4(or wherever suitable) add the month number i.e. for the first 31 columns, cells will have 01 in row4. For the next 28 columns cells in row 4 will have 02 and so on.
then in NK8, the formula to be entered should be
SUMIF($C$4:$NJ$4,$B$3,C8:NJ8)
which you can drag down for each person. B3 ahs the current month number you are viewing. The formula basically sums only those cells whose corresponding cell in row4 matches the month number in B3.
Here is a Google Sheet example.

Excel | Formula to find total amount in this situation

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

SUM values based on date in date range in array

i'm realy newbie in excel and i need to make advanced functions
I have excel (from Google Calendar) with booking system
A B C
12-01-2012 14-01-2012 8
13-01-2012 17-01-2012 11
15-01-2012 21-01-2012 3
A - start date
B - end date
C - number of guests
Now I need to SUM number of guest for all days in year and find every days where was more than 10 reservations.
For example, I need to return
12-01-2012 - 08 guests
13-01-2012 - 19 guests
14-01-2012 - 19 guests
15-01-2012 - 14 guests
May I do it without creating large excel file with all days combinations? And how?
I'm working on excel 2013.
This can be done quite simply by using the SUMIFS function. First you need to put each date in column D (set the first date you care about manually, then in D2 below, just say =D1+1 and copy down). Then to count the people for each of those days, put this in E1 and drag down:
=SUMIFS(C:C, A:A, ">="&D1, B:B,"<="&D1)
This will Sum the passengers listed in column C (must be formatted as numbers, not text - it looks like you might have some text values in there), if that row in column D (each day in the year) is within the range of Column A & Column B.
To find days larger than 10 people, simply have column F (in F1 and dragged down) say
=E1>=10
This will say TRUE if column E shows more than 10 people for that day.

Resources