Excel Prorated SUMIF - excel

I have a worksheet with 2 columns, one is a dollar amount, and the other is a day of the month (1 through 31) that the dollar amount is due by (the dollars are income streams).
So, I use the following formula to SUM all the income streams due on or before a certain day:
=SUMIF(C5:C14, "<="&$B$42,B5:B14)
Column C is the due day
B42 is the cell in which I input the day to compare to like "15" for "total of all income due on or before the 15th" - the idea is to have a sum of all income received for the period.
Column B is the dollar amount for each income stream.
My question is:
Some of the income streams don't have a day next to them (the day cell in column C is blank). That means that that income stream doesn't come in as a check or a chunk on a certain date, it trickles in roughly evenly through out the month. So if the amount for the income stream is $10,000 and the day is 15 in a 30 day month, then I should add $5,000 to the total.
That would be something like:
=SUMIF(C5:C14, "",???)
So where the due date is blank, select ???. ??? isn't just the number, it's the number*(given_day/total_days_in_month).
So I think what I need for an accurate total is:
=SUMIF(C5:C14, "<="&$B$42,B5:B14) + SUMIF(C5:C14, "",???)
But I'm not sure how to write that exactly.

Here you go:
SUMIF(C5:C14, "",B5:B14)*$B$42/DAY(DATE(YEAR(A1),MONTH(A1)+1,0)))

It depends on how you want to handle the number of days in February. You could use CHOOSE(Month($B$42),31,28,31,30,31,30,31,31,30,31,30,31) as the denominator, and DAY($B$42) as the numerator.
If you need to able to accommodate varying years where the number of days in February depends on the year in $B$42, then a more flexible approach could have a lookup table of years and the number of days in February in that year, and the 28 value in the CHOOSE formula above would instead be VLOOKUP(YEAR($B$42),MyYearLookupRange,2,false).

Related

SUMPRODUCT difference between two dates for THIS WEEK entries only

I have a column D containing all the Dates in DD/MM/YYYY format, and I would like to show the count of missed days for THIS WEEK values only from all the entries in column D.
In other words, if there is a difference between two Dates in column D and it occured this week, I would like to count it.
I have below formula to calculate "Total days missed" between first and the last entry in Dates column D, however I can't adopt this formula to display "Days Missed" for THIS WEEK only entries.
=SUMPRODUCT(--ISNA(MATCH(ROW(INDIRECT(MIN($D$18:$D$500)&":"&MAX($D$18:$D$500)));$D$18:$D$500;0)))
Sample of data set.
Please help, thanks.
For O365, in accord with your statement that there can be multiple entries of one date, I suggest the following (assuming your dates are real dates and not text strings that happen to look like dates):
Total Missing Dates
=MAX($D$18:$D$500)- MIN($D$18:$D$500)+1-COUNT(UNIQUE($D$18:$D$500))
Missing Dates THIS WEEK obviously, you'll need to define the first and last dates of THIS WEEK
=7-COUNT(FILTER(UNIQUE($D$18:$D$500),(UNIQUE($D$18:$D$500)>=wkStart)*(UNIQUE($D$18:$D$500)<=wkEnd)))
If your week starts on Monday, you can calculate:
wkStart: =TODAY()+1-WEEKDAY(TODAY()-1)
wkEnd: =wkStart+6
More generally, to return a particular day of the week prior to someDate (or wkStart):
wkStart = someDate - WEEKDAY(someDate - DayOfWeek)
where DayOfWeek is: Sunday=1 Monday=2 , etc
So, making someDate = TODAY()+1 ensures that if today is monday, it will return today and not the monday from a week ago.
HINT: It might be more convenient to define wkStart and wkEnd as a Named formula.

Excel: Number of weeks, when the income of weekends are more than the income of weekdays?

For example I have this sheet:
I want to calculate the number of weeks when the income of weekends are more than the income of weekdays.
(Income of weekends = Income of Sunday's + Saturday's income)
(Income of weekdays = Income Monday's + Tuesday's + Wednesday's + Thursday's + Friday's income)
For example in week 1: weekdays earning = 10$, weekends earning = 15$. Weekends earning > Weekday's earning
I'm not allowed to use helper columns.
If the layout is absolutely regular in full weeks as in the sample, I would use Offset to get the weekends and weeks as ranges, then Subtotal to get the sum of each of them as arrays, then compare them and finally use Sumproduct to get the count of those where weekend pay is greater than week's pay:
=SUMPRODUCT(--(SUBTOTAL(9,OFFSET(B2,ROW(INDIRECT("A1:A"&INT(COUNT(B:B)/7)))*7-2,0,2))>
SUBTOTAL(9,OFFSET(B2,ROW(INDIRECT("A1:A"&INT(COUNT(B:B)/7)))*7-7,0,5))))
The Row and Indirect are used to work out how many complete weeks there are, and so how many times the process has to be repeated.
Note - uses Indirect and Offset which are volatile and may give rise to performance issues with large sheets.

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.

MS-Excel Interest calculation using =IF

I want to calculate an interest on a fee, that is if a client has not paid full amount of fee before the 15th of the month an interest of 10% should added to the amount to be paid
my cells are
Amount payable Column B
Amount paid Column c
upstanding amount Column D
Date for payment Column E
penalty to be Paid 10% Column
How do i calculate this ?
i tried the below formula and had Err:509
=IF(E2=TODAY()>15, "Overdue" "B2*10/100",)
what i was trying to accomplish is .If today is on the 15th or the date is pass 15th of the month and there is upstanding amount to be paid attract a penalty of 10%
Things you could try
1) =if (e2>15, "overdue", b2*.10) or
=if (text (now (),"dd") > 15, "overdue", b2*.1)
You don't have a true and a false statement here (or rather the false statement is blank), also I don't know what you're trying to accomplish with e2=today ()>15 - if you're trying to get the day of the current month, you'll need e2=day (today ())>15

How to calculate a monthly average when the month is not finished

Let's say I have a 12 cells on column A with the sales for each month last year. To calculate a monthly I can do a simple formula like this in A13 =sum(A1:A12)/12. But in column B I have the sales for this year, not a complete year, and August is not finished, but I have the running amount of sales for this month, so far. What kind of formula can I use to return a more accurate average?
Eduardo
Divide the current total by the total number of days in the month that have passed so far. Then multiply by the total number of days in the month.
If you are only looking for a projection for the year I would recommend this:
Divide the sum you have for the current year * 365 so far in the data by days to date. That will give you a cheap sum.
sum * 365 / total days to date
Ideally you could figure out the ratio of revenue and you have a seasonal business:
Last year to date / last year total = Last year percentage to date
This year to date / Last year percentage to date : would project the average for the full year.
Easy 2-step process:
I have my data in two columns: Date, # of Widgets Sold
Add a 3rd column "Month", and use the month and year function to return the month for each date (format cells as a number) (e.g., =MONTH(A2)&"/"&YEAR(A2) )
Generate a pivot table using the # of Widgets Sold and Month columns that sums/averages the data by month

Resources