简体   繁体   中英

Excel Formula to Calculate Checkin Time

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

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.

So if i'm reading this correct you want to correspond the 'checkin time' with the first occurence of its bill number's 'time'?

You should use a formula in D2 like:

=INDEX($B$2:$B$1000,MATCH(TRUE,EXACT(E2,$E$2:$E$1000),0))

Confirm with Ctrl + Shift + Enter and drag down your formula

Note: Change $B$1000 and $E$1000 to whichever rownumber your sheets ends

EDIT 1

Here is an example of how this would work;

在此处输入图片说明

EDIT 2

Here is how it worked for me in your data:

在此处输入图片说明

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, ie 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM