Formula for SUMing certain months but disregard blank cells - excel

I'm trying to total sales amount in a column for a certain month. The column with the dates will include blank cells.
I got this code to work once but when I try to change the sheet it references it just comes up with $0.
=IF(ISBLANK(eBay!$A$2:$A$3000),0,(SUMPRODUCT((MONTH(eBay!$A$2:$A$3000)=1)*eBay!$H$2:$H$3000)))
Where the Month Column is eBay!A2:A3000 and the sales column is eBay!H2:H3000.
I've also tried:
=SUMIFS:(eBay!H2:H3000, eBay!A2:A3000, (MONTH(eBay!A2:A3000)=1, eBay!A2:A3000, "<>")
I tried the Evaluate Formula for the first formula and it comes up as TRUE for ISBLANK when there are two cells with dates in them.
The second formula says the MONTH is 4 when there is a Month for January. So I changed the date from 1 to 4 and it didn't total for April either.
I thought either one of these formulas would work. What can I try next?

Related

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.

Lookup date, return sum of previous 5 days

I am needing a bit of help on a formula which I have been amending for a while now with no success going through vlookups, indexmatches, sumproducts etc.
Basically, on one tab "weekly summary" I have the date contained in cell H2 which will only ever be set to a monday. I need a formula in cell B3 that will look up to a different tab "Raw Data Input" based on this date in cell H2, and return the sum of the values for the previous week (previous 5 amounts using the workdays formula on raw data input tab).
So for instance if this was today, 14th Nov, I would want the sum of the values from 7th-11th Nov.
Is this possible without doing 5 separate vlookups to different dates?
Ps. I will eventually form this into a macro, however as I have a number of tasks to complete before I get to that stage, I would prefer it as a formula, to get everything set up before I start adding VBA.
You can use SUMIFS where your multiple conditions are dates are less than 14th Nov, but greater than 14th Nov - 7
=SUMIFS(A:A,B:B, "<"&$H$2,B:B, ">"&$H$2-7)
Whereby A:A is the sum range, and B:B is the columns with dates.

MEDIANIF formula using months

I've written the following "MEDIANIF" array formula to give me the median of values (percentage returns) from column B that correspond to months in column A. In other words, I want the median of all values that correspond to January, February, March, etc...
This formula works perfectly for all months, except for January. I've manually verified it is working fine for all other months, but for whatever reason, it just returns 0 for January. This isn't a formatting issue or anything like that (everything is formatted consistently). I cannot for the life of me figure out why it won't work for January.
=MEDIAN(IF(MONTH(Data!$A$4:$A$65536)=1,Data!$B$4:$B$65536))
I'd post an image, but this is my first post and I can't post pics until i have at least 10 reputation!
The data is arranged with calendar months in column A (last trading day of the month) and percentage returns (formatted as a percent) in column B.
Any help is very much appreciated!
Thank you!
Excel will treat blank cells as zero (in this sort of formula, at least) and zero will be deemed to be a date in January (January 1900) so any blank rows will contribute a zero to the January median calculation; that's why you get incorrect results - add another check to ensure that the cells aren't blank, i.e.
=MEDIAN(IF(Data!$A$4:$A$65536<>"",IF(MONTH(Data!$A$4:$A$65536)=1,Data!$B$4:$B$65536)))
Alternatively you could limit the formula to rows with data - perhaps employing dynamic named ranges if the amount of data is variable

Adding new criteria to my formula

I have formula from that, I am getting output, now I wanted to add one more criteria,
=SUM(SUMIF('Data '!$C$2:$C$410,IF(H7=Translation!$A$2:$A$27,Translation!$C$2:$C$27),'Data '!$J$2:$J$410)*COUNTIF(H7,Translation!$A$2:$A$27)*Translation!$E$2:$E$27)
I wanted to show only last 30 days data, date is in Data sheet column number I.
Any suggestion would be great.
To do that you can change the SUMIF to a SUMIFS function and include the date criteria within that SUMIFS, i.e. with dates in column I this will only cover the last 30 days including today
=SUM(SUMIFS('Data '!$J$2:$J$410,'Data '!$C$2:$C$410,IF(H7=Translation!$A$2:$A$27,Translation!$C$2:$C$27),'Data '!$I$2:$I$410,">"&TODAY()-30,'Data '!$I$2:$I$410,"<="&TODAY())*COUNTIF(H7,Translation!$A$2:$A$27)*Translation!$E$2:$E$27)
confirmed with CTRL+SHIFT+ENTER as before
SUMIFS requires Excel 2007 or later

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