Counting Available Days in a Row - excel

I'm trying to calculate the number of consecutive available days I can schedule my drivers. The schedule I've included shows a date range of 12 days, starting with the day prior. I've tried everything I know but haven't had any luck. For analysis purposes I've boxed and highlighted the "available days" and included a column titled "desired results". The total driver counts are in the hundreds and the future available days are interrupted by other activity on a driver's schedule. My need is to count the blank slots that start today and end with the first populated cell on that driver's schedule (by row).

As far as I can understand, you want to count the number of blank cells beginning in column B until the next populated cell in each row, the following formula will help you achieve your desired results:
=IFERROR(IF(AND(MATCH(TRUE,INDEX(B2:L2="",0),0)=1,MATCH(FALSE,INDEX(B2:L2="",0),0)<>1),MATCH(FALSE,INDEX(B2:L2="",0),0)-1,0),0)
In essence the formula will check if the first Cell in the range (ie. Column B) is blank, then it will check for the first non blank cell in the row, and then give you the results, all this is wrapped in an IFERROR to convert errors to 0.

So it looks like you want to count how many empty cells are in each row, columns B:L, until first non empty cell is found:
My formula in M2 is:
=MATCH("*";B2:L2;0)-1
Drag it down and hope you can adapt it to your needs.

Related

How do I create a formula that will return a date where the sum of it and previous dates are greater than some requested number?

Example of Product Data and Inbounds
I have 20 products that I sell that each have some requested amount that people want to buy. I am struggling to figure out a formula by which I could have it return the week where the sum of it and previous weeks is greater than the amount requested, so I know on what week of inbounds the order can be fulfilled.
The example data only shows three columns of dates but in reality there could be up to 20 weeks of inbounds inventory, so it would be potentially a large series of sums before it finds the one greater than the amount requested. In the example image the cells highlighted in green are the correct week for each product that I manually marked.
Thanks for the help, I'm not sure where to even start on this.
Assuming that your table start in cell A1 (therefore the cell C2 value is 96), use this formula for your conditional formatting starting from cell C2:
=AND(SUM($C2:C2)>=$B2,SUM($B2:B2)-$B2<$B2)
Warning: the formula might stop working if the overall structure of the table is changed. For example: if columns with non-numeric data are inserted, the user will need to re-apply the conditional formatting. If said inserted columns will contain numeric value that are not meant to be sum in the formula, it won't suffice anymore.
I am afraid I don't have time to write a full answer but the below might help. I am sure there is a way to avoid writing multiple COUNTIFS with a SUMPRODUCT but I haven't got there yet.
=SUM(1,
COUNTIFS($B3,">"&$C3),
COUNTIFS($B3,">" & SUM($C3:$D3)),
COUNTIFS($B3,">" & SUM($C3:$E3))
)
This is a model built around your having 20 weeks so that you can have one formula which doesn't require continuous adjustment - it does require one column of helper cells for each week, though:
the helper cells start in column Y, where the formula in Y2 is
=SUM($C2:C2)
which is then copied to the right as far as column AR, and then copied down, one row for each of your products.
With all of the helper cells populated, the array formula in W2 is
=IFNA(INDEX($C$1:$V$1,MATCH(1,N((Y2:AR2-B2)>0),0)),"In the future")
which is then copied down, one row for each of your products.

Excel formula to calculate the time a device is on and off

I have a dehumidifier that turns on and off. I want to find out how many minutes it is on and then how many minutes it is off. I have three cells:
A1 - Date
B1 - Time
C1 - Status (On or Off)
I need a formula that will look in Cell C1 and if it contains "On" then continue looking at all consecutive cells for the last "On" and then calculate the time difference in column B and place this calculated value in column D. Below I show the calculated minutes in the last row where the status is found, but it doesn't matter if it is the first or last instance of the value "On". I've got the hard part of calculating the difference in time down. I need help with the easy part of searching through the consecutive on's and off's and calculating the difference between the times. I've tried using vlookup, index and match but come up empty each time. Below is an image of the table.
Thanks in advance for any assistance.
Enter the following formula in Cell D2:
=IF(C2=C3,"",ROW(C2)-LARGE(IF($D$1:D1<>"",ROW($D$1:D1)),1)-1)
Use the fill handle to drag down.
Note: This formula assumes that each row represents one minute, and counts accordingly. This will not work if a row skips a minute.
That produces an integer with how many minutes elapsed.
If you want 0:05:00 format, use this formula:
=IF(C2=C3,"",(ROW(C2)-LARGE(IF($D$1:D1<>"",ROW($D$1:D1)),1)-1)*0.000694444444444444)
Format Column D using this format:
[h]:mm:ss

Excel - SUM Daily results based on given date range

thank you for taking a minute to help me!
I have 3 sheets, 3 of them with daily data of users, vehicles, and population which is steady, all of them have the same structure:
D column is location and the rest are daily results. Results change every 14 days, that's why for each location you are seeing the same data.
And there's a 4th, where I want to concentrate results from the previous sheets based on data and location - location is D column:
I want to set both start and end date and based on that, sum daily results by location. For example, suppose that Inicio - Start date is 01/03/2020 and Termino - End Date is 05/03/2020, in the second image, where I highlight SUM HERE it should appear 227,340 for 001-L1 Dr. Galvez N.
I already tried SUMIF, SUMIFS, SUMPRODUCT but it doesn´t seem to work.
Any ideas?
What didn't work with SUMPRODUCT? Try this - the result is correct:
=SUMPRODUCT((Sheet1!$E$3:$M$3>=$E$2)*(Sheet1!$E$3:$M$3<=$F$2)*(Sheet1!$D$2:$D$14=D5)*Sheet1!$E$4:$M$14)
I tried to adjust the ranges to your example, but change them if necessary.
I have developed this formula for you (001). Please take a look.
[E5] =SUMIFS(INDEX(Counts1,MATCH($D5,Stops1,0),0),Dates1,">=" & $E$2,Dates1,"<=" & $F$2)
The formula is designed for cell E5 of your fourth sheet. $D5, $E$2 and $F$2 are all on this sheet.
Counts1 is a named range on Sheet1, comprising all the passenger counts, starting from column E, up to the last day of the month and, vertically, from row 4 to as many rows as there are stations.
Stops1 is another named range on Sheet1 D4:[end of column].
Dates1 is a third named range on Sheet1, starting from E2:[end of row]. I would suggest you set up these named ranges to adjust dynamically to the actually used areas of the sheet.
Now, INDEX(Counts,MATCH($D5,Stops,0),0) defines all cells in the row of Counts where the Stop is equal to D5. Of course, this reference changes as you copy the formula down.
SUMIFS takes that range, extracts and sums up the numbers you are interested in.
Now, if you need to extract the same numbers by the same system from 3 different sheets you simply repeat the formula 3 times, concatenating the results with plus signs. That leaves you with the task to set up 9 ranges instead of only 3, each group of 3 on one of your source sheets. By the system I have implied above you would name them Count2, Count3 etc.
That leaves the question of your dates. They must be true dates. Text strings that look like dates won't do. (I guess you know that :-). In the test sheet I set up I entered =DATE(2020,3,1) in E2, [F2]=E2+1 and copied from F2 to the right.

Counting unique numbers of tasks, when another cell range contains a random amount of dates

We have a spreadsheet that has many columns, however I'm needing help with developing a formula that encompasses only two of those columns. The sheet itself is setup like this:
Date Task
6/1/18 Row
6/1/18 Spot
6/1/18 Row
6/2/18 Spot
6/2/18 Spot
6/3/18 Row
6/3/18 Row
6/3/18 Row
6/3/18 Spot
...etc
Based on the above values, I am trying to figure out how many times Row appears in the "Task" list, however only counting it for unique dates. So on 6/1 we had Row twice, however it should only count as once, since we only spent one day doing the Row task. On 6/2, Row is not there at all, so our total amount of days doing the Row task is still at 1. On 6/3, Row was done 3 different times, however it should only count as one day, bringing the total amount of days we have worked on Row to 2.
Likewise, if we were to calculate for "Spot" then the total number of days worked on "Spot" would be 3. (This would be a separate cell value, but same premise, therefore same formula.)
I don't have the slightest idea how to get this formula even started. I know quite a bit about Excel, however my knowledge does not cover this specific issue, and I am not sure where to even start.
Any help would be greatly appreciated!
This is my bookmark for counting unique rows with a criteria: link
The formula that will work for you is:
=SUM(--(FREQUENCY(IF($B$2:$B$10=D1,MATCH($A$2:$A$10,$A$2:$A$10,0)),ROW($A$2:$A$10)-ROW($A$2)+1)>0))
This is an array formula and will need to be entered with Ctrl+Shift+Enter while still in the formula bar.
Here's one solution:
Column A and B are your columns
Cell C1 in C column (and all else): =A2&B2
D1 is simply 1
D2 cell is (drag that formula down also): =IF(COUNTIF($C$1:$C1, C2)>0, 0, 1)
H1 cell is: =SUMIF($B$1:$B$200, G1, $D$1:$D$200)
G1 is "Row"
Hope it helps!

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