I have a file from restaurant log of 1 month. I need to calculate the Checkin Time time from Time and Bill Number column.
My Format is:
Date |Time| TableNumber| Checkin time |Bill Number ..|...|...|
I can calculate it manually one at a time by copying the 1st data of Time column and copying in Checkin time where bill number is same.
I have attached a Screenshot of the data.
Example 1: Blue square
Here in the blue square we can see that first value of Time column is 0:02:37 and I have pasted it in Checkin time which has Bill Number 29 .
Example 2: Red square
First value of Time is 16:08:40 And I have pasted in Checkin time column which have bill number of 1 and so on..
I did it manually without any equation or formulas. But the problem is the data is of 1 month and I have about 6 to be calculated.
What I tried
From the formula given to me by #girlvsdata
I tried
=MINIFS(B:B,E:E,E3)
I did get the data for 1st two unique Bill numbers, but after dragging down the forumla further down, I get different Time for new bill number. + as the bill number repeats in further down rows many times, it gives me same time of 1st bill number for repeated bill numbers.
Here is the screenshot of after What I tried
Screenshot_after
I propose the following:
=IF(AND(E3=E1,C3=C1,A3=A1),D1,MIN(OFFSET(E3,0,-3,MATCH(0,(E3:E$18=E3)*(C3:C$18=C3)*(A3:A$18=A3),0)-1,1)))
It is a bit long and will likely take a while to calculate if you have lots of rows. The above formula is to be entered as an array formula, i.e. copy/type the formula then instead of pressing Enter, use Ctrl+Shift+Enter. If you do it right, excel will insert {} around it like in the screen shot below:
Change the ranges E3:E$18, C3:C$18 and A3:A$18 accordingly and notice that they are all one row below the end of the table (otherwise you get #N/A for the last bill).
If you have the latest version of Excel, you can use =MINIFS() to find the first Time for that particular Bill Number (the Checkin time).
In cell D3 enter this formula:
=MINIFS(B:B,E:E,E3)
Make sure that the cell has Time formatting for it to show correctly.
Related
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
I have a data having two date columns. SHUT HOURS column I calculate after subtracting FEEDON from FEEDOFF date. I need the information for number of shut hours on each day. If I just subtract FEEDON from FEEDOFF, it will give me total number of hours for all days. But I want for each day. Is there any way where I can find number of SHUT HOURS on each day from FEEDOFF and FEEDON date?
The output I want is in the following picture. For example, for first row I want all dates in different cells corresponding to different number of hours. Is there any way to do that?
This is ARRAY (CSE) formula. Press Control+Shift+Enter after pasting the formula.
Formula in G1 is
=ABS(IF(COUNTIFS($A$2:$A$4,"<="&E1+86399/86400,$B$2:$B$4,">="&E1)>0,1,0)*IFERROR(IF(MATCH(E1,INT($A$2:$A$4),0)=MATCH(E1,INT($B$2:$B$4),0),INDEX($B$2:$B$4,MATCH(E1,INT($B$2:$B$4),0),1)-INDEX($A$2:$A$4,MATCH(E1,INT($A$2:$A$4),0),1),""),IFERROR(INDEX($A$2:$A$4,MATCH(E1,INT($A$2:$A$4),0),1)-E1-1,1)*IFERROR(INDEX($B$2:$B$4,MATCH(E1,INT($B$2:$B$4),0),1)-E1,1))*24)
Pasting again being too long to scroll
=ABS(IF(COUNTIFS($A$2:$A$4,"<="&E1+86399/86400,$B$2:$B$4,">="&E1)>0,1,0)*IFERROR(IF(MATCH(E1,INT($A$2:$A$4),0)=MATCH(E1,INT($B$2:$B$4),0),INDEX($B$2:$B$4,MATCH(E1,INT($B$2:$B$4),0),1)-INDEX($A$2:$A$4,MATCH(E1,INT($A$2:$A$4),0),1),""),IFERROR(INDEX($A$2:$A$4,MATCH(E1,INT($A$2:$A$4),0),1)-E1-1,1)*IFERROR(INDEX($B$2:$B$4,MATCH(E1,INT($B$2:$B$4),0),1)-E1,1))*24)
Got help from this link
This will fail if the dates are overlapping as in case of your fourth row is overlapping the first and the third.
I'm trying to set up an excel sheet which displays the name of the person available at the current time and date. I have one sheet with a list of dates and times along with the persons name who is available at that time. For example:
- 01/07/19 09:00 Bob
- 01/07/19 10:00 Bill
- 01/07/19 11:00 Ben
I can do this successfully for a full day or week using the WEEKNUM or DAYNUM functions, and the week/day number listed against the list of names.
I can use NOW() to get the current date and time, but I'm unsure how I can use this to get the desired results.
I've tried searching online for the answer but have been unable to find what I'm looking for.
Based on my example above, if the current time is between 9:00 & 10:00 I want the name Bill to be displayed.
Based on your dates being actual dates stored as number for excel and not numbers stored as text, and same for time, then the following solution should work for you. You can test your data to see if its an actual date using:
=ISNUMBER(A2) `where A2 is the cell in question
If the formula returns true then you know your are dealing with a number that has been formatted to display as a date or time.
As a side note, dates are stored as integers and are the number of days since 1900/01/01 with that date being 1. Time is stored as a decimal representing the portion of the day. 0.5 would be 12 noon.
This solution assumes the data is layed out as per the image below.
In cell F1, place your NOW() function. I have manually entered the date to control the value for demonstration purposes.
In cell F2 enter the following formula:
=INDEX(C:C,AGGREGATE(15,6,ROW($A$2:$A$4)/((INT($F$1)=$A$2:$A$4)*(MOD($F$1,1)<=$B$2:$B$4)),1))
AGGREGATE will make a list or all row number and sort them from largest to smallest. All Those row numbers will be divided by your criteria checks. If your criteria results are ALL True, then the row is divided by 1 and remains unchanged. If a criteria is not met the Row number is divided by 0 which causes an error. The 6 in the function tells aggregate to ignore error results. So you wind up with a list or row numbers that march your criteria. The 15 in aggregate tells aggregate to sort the row numbers from largest to smallest. The 1 tells aggregate to return the row number in position 1 of the sorted list. Aggregate then passes that row number to INDEX which finds the row in the corresponding column and returns the address of that cell.
now just so you are aware. The break point for time was set so that the person beside the list time is the one that will be picked when that exact time is provided. Meaning for a time of 0900 on the specified day, Bob would be selected. At 10:00:01 Ben will be selected. At 11:00:01 an error will be generated. you can control this by placing the whole thing in an IFERROR function. At 00:00:00 Bob is selected.
I believe this will do what you want:
=INDEX(C2:C4,MATCH(NOW()-TODAY(),B2:B4,1))
Where column C contains the names and column B the times
If date and time are in one column, you can try:
=INDEX(B1:B3,MATCH(NOW(),A1:A3,1))
Where column B contains the names and column A the date and time
Here is one way:
Formula in F1:
=INDEX(C2:C4,MATCH(1,INDEX((A2:A4=TODAY())*(HOUR(B2:B4)<=HOUR(NOW()))*(HOUR(B2:B4)>=HOUR(NOW())),0,1),0))
What's happening? We use MATCH to get the first TRUE in an INDEX list that compares column A against TODAY times column B for HOUR.
We can leave out the second INDEX but that would make it an array formula to be entered through CtrlShiftEnter
Note that this example is made around 9:30 on the 4th of July.
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.
I'd like to make it so that an error is returned if a calculated cell attempts to go below zero. I have made a vacation day excel sheet so that if a person schedules a vacation day, the total amount of vacation days remaining decrease. The thing is, if I schedule for more days than I have available, the calculated cell for the remaining days will go into the negative values since it is calculated and not user entered. I used data validation on the cell and if I try to manually enter a negative number it wont allow me. I just want the same thing to happen for a calculated cell.
Data Validation is not appropriate for this task, instead use:
=IF(your_formula<0,"ERROR",your_formula)
If Column A is Total Vacation Days allowed, Column B is the Total Vacation Days Used, and Column C is the formula =A1-B1, then apply custom data validation to B1. The formula would be =B1<=A1. That should work. It's not applying it to the answer cell, but the input cell creating the error.