Excel Formula.

AliaNi

New Member
Joined
Oct 19, 2022
Messages
32
Office Version
  1. 2010
Platform
  1. Windows
Hi I need help with a formula. I tried so many and they either return zero or spill and I don't know what's wrong with it. Xl2BB isn't working.

I want to return ID 2.

I want to look at Area Out, and then look at Area In with the same area code. Then return the ID associated with the earliest Date right from Date In after Date out.

So for ID 1, it's going to be 6.


IDDate InDate OutArea InArea Out
1​
2/19/24 8:25 AM​
2/21/24 3:37 PM​
330330
2​
2/16/24 11:05 PM​
2/18/24 5:15 PM​
326330
3​
1/13/24 6:52 AM​
1/15/24 6:56 PM​
330330
4​
1/20/24 7:37 AM​
1/22/24 9:48 PM​
330330
5​
2/25/24 12:16 AM​
2/27/24 4:07 PM​
330330
6​
1/22/24 6:10 AM​
1/25/24 2:39 PM​
330330
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I tried so many and they either return zero or spill ....
It looks like you have access to Excel 365? if so, can you please update your Account details, as solutions may vary with Excel version.

I don't understand either of these two points:

I want to return ID 2.

So for ID 1, it's going to be 6.
But based on your explanation, I am guessing:

ABCDEFG
1IDInOutArea InArea Out
2119 Feb 2024 08:2521 Feb 2024 15:373303305
3216 Feb 2024 11:0518 Feb 2024 17:153263301
4313 Jan 2024 06:5215 Jan 2024 18:563303304
5420 Jan 2024 07:3722 Jan 2024 21:483303301
6525 Feb 2024 12:1627 Feb 2024 16:07330330-
7622 Jan 2024 06:1025 Jan 2024 14:393303301
Sheet1
Cell Formulas
RangeFormula
G2:G7G2=TAKE(SORT(FILTER(A$2:B$7,(D$2:D$7=E2)*(B$2:B$7>C2),{"-",0}),2,1),1,1)

Example: For ID #3, Area Out is 330, Time out is 15 Jan 2024 6:56 PM.
There are four IDs (1, 4, 5, and 6) with Area In =330, and Time In > 15 Jan 2024 6:56 PM.
Of these four, ID #4 has the earliest Time In.
Hence the solution shown is ID #4.
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top