Find the value for the exact or closest time

alvintranvcu123

New Member
Joined
Jan 16, 2025
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Dear all/

I have the temperature data, which were measured from 02 sources. The measuring times may be different. They could be the same or near the same in 02 sources.
I would
I would like to make it a table.

1. Exact time: show 02 temp values

2. Not exact time: show 02 temp which one temp is the closest time in table 1.

( 1)
10:04:04 AM1455
10:04:14 AM1463
10:04:24 AM1458
10:04:34 AM1463
10:04:44 AM1472
10:04:54 AM1487
10:05:04 AM1496
10:05:14 AM1504
(2)
10:01:59 AM1565
10:04:07 AM1548
10:05:30 AM1568
10:06:00 AM1564
10:07:27 AM1566
10:08:27 AM1535
10:09:31 AM1545
10:09:57 AM1545
 
You didn't answer the question. Are you using a structured reference table, where a formula can include references like [Temp] or [@Temp]?

And when you say the formula "didn't work", does that mean the cell wouldn't accept the formula? Or it did accept the formula, but it produced an error? Or wrong results?
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I copied your format, pasted to excel file.

1737096444215.png
 
Upvote 0
With cell references ...

ABCDEFG
1Table2Table1
2TimeTempTimeTempTable 2 temp
310A9PA
412B15QC
516C19RD
620D21S
730E26T
835F31UE
941VF
Sheet1
Cell Formulas
RangeFormula
G3:G9G3=LET(T2Time,B$3:B$8,T2Temp,C$3:C$8,T1Time,E$3:E$9,T1Temp,F$3:F$9,A,BYROW(T1Time,LAMBDA(r,LET(a,ABS(T2Time-r),XLOOKUP(MIN(a),a,T2Temp)))),B,BYROW(T2Time,LAMBDA(r,LET(a,ABS(T1Time-r),XLOOKUP(MIN(a),a,T1Temp)))),IF(MMULT(--(A=TRANSPOSE(A)),SEQUENCE(ROWS(A),,,0))=1,A,IF(XLOOKUP(A,T2Temp,B)=T1Temp,A,"")))
Dynamic array formulas.
 
Upvote 0
Oh, It's work very well. So glad. sorry for my poor knowledge of Excel. Now, I've just copied & pasted data to your format.
Thanks so much.
How can I thank you?
 
Upvote 0
In Post #13, G3 is a single-cell formula. You don't need to copy it down the column. That's why you're getting the #SPILL! errors.

Let me know if you still have thread processing problems, as we can make the formula more efficient and/or use helper cells.

How many rows do you have in your actual tables? Will the times always be sorted in ascending order, as you've shown above?
 
Upvote 0
See if this is faster for you. Similar to StephenCrump's, it's an array formula so insert in the first cell only and clear out everything below.
Book1
BCDEFGH
1Table2Table1
2TimeTempTimeTempTable 2 temp
310A9PA<-Insert formula here only
412B15QC
516C19RD
620D21S
730E26T
835F31UE
941VF
Sheet1
Cell Formulas
RangeFormula
G3:G9G3=LET( t,TOROW(C3:C8),a,ABS(TOROW(B3:B8)-E3:E9),r,ROWS(a), b,BYROW(IF((SEQUENCE(r)=r)+(a=BYROW(a,MIN))*(a=BYCOL(a,MIN)),t,""),LAMBDA(x,XLOOKUP(TRUE,x<>"",x,"",,-1))), IF(XMATCH(b,b)=SEQUENCE(ROWS(b)),b,"") )
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,225,613
Messages
6,186,003
Members
453,334
Latest member
Prakash Jha

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