Change value, based on current month - excel

I have the following tables
Here is the table I have (Picture 1). Similar tables would be generated for each month, but each month might have more or less rows compared to the previous. It all depends on the data that needs to be inserted. What is important is the cell named "TOTAL" for each month.
So, on a different sheet I have the Picture 2 table, where I need to populate the TOTAL of the month we are currently in. In this case I would need to have the November Total populated.
Picture 1: https://i.stack.imgur.com/2U3bX.png
Picture 2: https://i.stack.imgur.com/CHimY.png
How can I populate the values for "Total for the current month" automatically, based on the current month? Meaning that when the month changes, the value for that cell should change as well and should be populated from the current month's "TOTAL" cell.
Thank you all!

EDIT due to the refined question:
You need to use SUMIFS to sum the TOTAL where the related date matches the current month.
Assuming that your criteria is that you always calculate the month based on TODAY(), we can use TODAY() as well in the formula.
So if you have your Value cell in B2, paste this in:
=SUMIFS(I:I;H:H;">="&DATE(YEAR(TODAY());MONTH(TODAY());1);H:H;"<="&EOMONTH(TODAY();0))
where I:I is the TOTAL column and H:H is the dates column in your orders table.
The >= and <= indicates the range of dats between the first and last day of the CURRENT month (based on TODAY()).

Related

how to count all the entries put under a row having specific days of a month

In this Sheet:
How to count all the entries (Text or Numbers) under A1 to AD1 (based on days only from Sun to Thu.) except Fri and Sat.
Note: if month is changed from list thus all the dates and days will be changed. Counting done as per changed month
Note: if month is changed from list thus all the dates and days will be changed. Counting done as per changed month
Given there are two rows at the top of the sheet, I am going to assume you want to check the contents of A3:AD3 against the day of the week in row A1:AD1
My simple answer is this formula at the end of each row (cell AF3, for example)
=COUNTIFS(A3:AD3,"=*",A1:AD1,"Sunday")+COUNTIFS(A3:AD3,">0",A1:AD1,"Sunday")+
COUNTIFS(A3:AD3,"=*",A1:AD1,"Monday")+COUNTIFS(A3:AD3,">0",A1:AD1,"Monday")+
...
You could also create a hidden helper row (let's call it AD2) that operates on the date row using the WEEKDAY() function, which will generate a number between 1 an 7 for the day of the week starting with Sunday. In this implementation, you would only need the following:
=COUNTIFS(A3:AD3,"=*",A2:AD2,"<6")+COUNTIFS(A3:AD3,">0",A2:AD2,"<6")
Another solution would be to copy/paste a similar formula across the columns at the top of the sheet (row1, for example), as follows:
=IF(WEEKDAY(A2)<6,COUNTIF(A3:A32768,"=*")+COUNTIF(A3:A32768,">0"),"")
This assumes your date is in row2 and the data entries start in row3. As rows are added to the sheet the formula will work without requiring any action. In this example I used 32768 for the max number of rows but this is arbitrary.
To get the overall total you would sum the across the columns of row1, such as SUM(1:1) or sum (A1:ZZ1) depending on the number of columns you have.

Increment Date by One Day in Formula - Excel

I want to have separate two columns that each row has a date, and another row containing total sale of the date.
I want my formula to increment the date by a day and automatically sum every transactions in that day.
I apologize if my explanation is awful.
Use Sumif To Sum Value See Bellow Mention Screenshot
=SUMIF(A:B,D2,B:B)

How to sum data in a column corresponding to a start date to today's date

So, I am working on a loan payoff sheet and I wanted my excel sheet to be automatically updating.
One of my questions was answered when I searched how to select data corresponding to today's date using the function VLOOKUP(TODAY(),A:B,2,0) but that will only respond data in the column adjacent to today's date.
I would like to sum the data in the column of daily interest from the start date (provided) and have it automatically update for today's date. Attached is a snapshot of what I am trying to describe.
I currently have the dates stretched out several months in the future and am just summing the entire column of daily interest values.
If anyone knows how I can choose a start date of the first day and then automatically sum the values of the dates in between that would be fantastic.
Assuming Column A is your Date column and its the only numbers in the column you can use:
=MIN(A:A)
Having said that normally charts like this are built by a start date provided in a cell somewhere. If you can find that cell, simply link to it instead.
In order to get your sum of only appropriate dates, you will want to look at the formula SUMIFS. This will allow you to have multiple criteria that all have to be true. Assuming your interest is in column C you might be able to use the following formula:
=SUMIFS(C:C,A:A,">="&MIN(A:A),A:A,"<="&TODAY())
'Substitute your direct cell link for MIN(A:A) if you have it
Basically
=SUMIFS(Range to sum, range to check 1, criteria for check 1, range to check 2, criteria for check 2)
If for some reason you have data above and below your dates and interest column, you may need to adjust your ranges from A:A to A5:A678 where 5 is the first row of your data and 678 is the last row of your data.
With dates in column A and value in column B, place the start date in C1 and the formula:
=TODAY()
in C2. Then in another cell enter:
=SUMPRODUCT(--(A1:A9999<C2)*(A1:A9999>C1)*B1:B9999)
This formula give the sum of values between the date limits (not including).
The formula does not require the dates in column A to be in sorted order.

Calculate monthly average from daily data without PivotTable

My worksheet contains two columns: column A contains the date in the format dd/mm/yyyy and column B contains the daily data. From the daily data I have to generate the monthly average for each month without a PivotTable. Some of the days contain no data at all. I cannot use a PivotTable as I have to use the monthly average to identify outliers in the daily data at a later stage.
For this example it's important that I don't use a PivotTable and that I can generate the monthly average data for any month and year in my list. The solution can be an Excel formula or VBA.
Assuming you have the months in column D enter this formula in E2 and copy till last month
=AVERAGEIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0))
Some of the days contain no data at all.
In case this means that there are no row for some dates and you want to calculate average based on full month than you can use the below formula:
Continuing with example given by EEM
=SUMIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0))/DAY(EOMONTH(D2,0))
In case Daily Data contains some #N/A, one can add a additional criteria to skip non number data:
=AVERAGEIFS($B$1:$B$62,$A$1:$A$62,">="&D2,$A$1:$A$62,"<="&EOMONTH(D2,0),$B$1:$B$62,"<10E69")
Given a single date you can calculate both the End of the Month and the First of the Month for that date. Assume any given date is in E4:
For the End of the Month
=EOMONTH(E4,0)
For the First of the Month
=EOMONTH(EDATE(E4,-1),0)+1
If you place a date, any date, of the month you want to review into cell E4 the two above code snipets will give you and last and first days of the month. EDATE allows you to add and subtract whole numbers to change the month. We take one month away from the current month, found within the date in cell E4, and then find the end of the month and add a one to it to become the first day of the next month. It will work with any date. The below example shows grade averages over a month referencing any given date within the month.
Pic of the above Excel example
=AVERAGEIFS(C2:C11, B2:B11,">=" & EOMONTH(EDATE(E4,-1),0)+1, B2:B11,"<=" &EOMONTH(E4,0), A2:A11, E2)

Month-to-date totals

I have an Excel workbook that has several different worksheets in it. The one worksheet that contains the main data has 100's of entries. This sheet also gets a new entry every day in the row column. The first column is the date column that is formatted as date and time.
I need a formula that checks the newest entry's date to see if its month matches the current month and then sums all entries for that month. I know that I am going to use a SUMIF but the hard part is the rest of the formula. I forgot to mention that I need the formula to divide by the number of current month entries used.
Assuming your dates are in A1:A26 and amounts to be summed are in in B1:B26 here is the formula to use.
=SUMIFS(B1:B26,A1:A26,">="&DATE(YEAR(TODAY()),MONTH(TODAY()),1),A1:A26,"<="&TODAY())
This returns the amounts that are in a date that is greater than or equal to the first day of the current month, AND less than or equal to TODAY.
There are a couple ways you could do this and I would suggest using sumproduct formula.
I'm assuming your data has dates in column A starting in row 2, and a value in column B.
In column C you could have a total in each line which is the sum of all rows above the current one that the month matches.
Formula in C2 would be below which can be carried down
=SUMPRODUCT(--(MONTH(A2)=MONTH($A$2:A2)),$B$2:B2)
Otherwise if you have a single cell and just want to get the latest total this formula would do it. This assumes the latest entry will also be the newest date (highest value)
=SUMPRODUCT(--(MONTH(MAX(A:A))=MONTH(A2:A1000)),B2:B1000)
In sumproduct the first part of the formula --(A=B) returns true or false values which equate to 1s and 0s. The second part is just your value columns.
The second formula does the same thing but it compares the month of the newest date to all others in the column.
Gordon
Since new entries are added daily I am assuming these are in date order ascending, so please try:
=SUMIF(A:A,">"&EOMONTH(TODAY(),-1),AD1:AD100)
or adjust the AD range to suit (could use AD:AD).

Resources