Excel COUNTIF increment date for pasting - excel

I have a transaction table with two columns- ID and Date. Each id is unique and never repeated.
I want to count the number of transactions for each day of the past few years, without typing the formula for each day. When I try to pull down the formula =COUNTIF(B2:B5000, "1/1/17") to cells below, it changes the cell range rather than the date.

Try
=COUNTIF($B$2:$B$5000,DATE(2017,1,ROW(A1)))

Related

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)

N-Count Days For Changing Dates For Ecommerce Shipment Sheet

I have to submit a daily MIS for orders which are Undelivered For less then 2 Days, Undelivered Between 3-5 Days and 5+ Days.
Currently i'm doing this manually by counting from the Purchase Date forward. So e.g. for an order of 11th March, i'll just count 2 days till 13th (If undelivered) and type 1 in front of the column and do a count manually of all orders outstanding in each column.
The problem arises as the column descends and the dates get further and further away from current day.
This is tiresome but i can't seem to find an algorithm that can do this automatically.
Can anyone help please.
Consider this screenshot:
Cell A1 has the date you want to compare to. Don't user the Today() function, since it is volatile and can slow down the workbook. Just manually put in the desired date.
The formula in cell E2 is
=IF(D2="undelivered",IF($A$1-C2<=2,"less than 2",IF($A$1-C2<=5,"3 - 5 days","5+ days")),"")
In words: if the status is "undelivered", calculate the difference between purchase date and A1. If it is less than 2, return that text, if it is less than 5, return that text, otherwise return the third text.
Copy that formula down.
In cells G3 to G5 you see each of the three texts and next to it is a formula. Starting in H3
=COUNTIF(E:E,G3)
copied down to H5.
Your layout may differ, so you will need to adjust the formulas accordingly.

Excel : MAX number in any 30 day period

I`m trying to work out a formula, on how to get the MAX amount, for any 30 day consumption period, for a certain item, when all the criteria are in one data table. See picture below. Date is in column A.
I have table with a formula where I copy and paste data manually
=SUM(IF([Date]>[#Date]-30,IF([Date]<=[#Date],[Amount])))
At the end- I would like to have the list of all the item numbers in one column and the one next to it should have - max amount used in any 30 day period.
In my Master file I have around 1300 Item numbers, which is time-consuming to get the MAX data on-by-one.
Can anyone help?
Instead of copy and paste, you can do a pivot table on the data in the first screenshot. Use the dates in rows, use the Amount in values. If you want to do this for item numbers, use them in rows before the date.
You should then have a nice table with dates and amounts per date, no duplicate dates.
If you don't want to use pivot tables, create the date column manually, without duplicates, and use a Sumifs formula to sum the data from the original sheet. Enter the start date, then use the fill handle and drag down. That will automatically increment the date. Let's say the dates are in column A, first row has labels, then use in B2 and copy down:
=sumifs('the other sheet'!H:H,'the other sheet'!A:A,A2)
Next, in C2 you can use a MAXIFS function along the lines of
=MAXIFS(B:B,A:A,"<="&A2-30)

how to calculate values using COUNTIF

I have two sheets in my Excel file: Sheet1 and Sheet2.
In Sheet2 i have data with columns Severity and LodgedDate. In Severity there are multiple values like
sev-1
sev-2
sev-3
sev-4
In Sheet1 I want to calculate the no. of occurrences for sev-1, sev-2, sev-3, sev-4 for today, this month, this financial quarter, last quarter, older than last quarter.
Can anyone help?
Like
=COUNTIF(shee2, C2:C,"sev-1" , "Today").
Assuming the date is in column B, try along the lines of
=countifs(Sheet2!C:C,"sev-1",Sheet2!B:B,today())
For the current month
=COUNTIFS(Sheet2!C:C,"sev-1",Sheet2!B:B,">=1-Mar-2017",Sheet2!B:B,"<31-Mar-2017")
So, for a time frame enter the first and the last day of the time frame into two conditions.
You may want to use a pivot table instead of countifs formulas. It is a lot faster and won't require you to type out all the possibilities.

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