LOOKUP result vector error

shane23

New Member
Joined
Feb 14, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I have an issue with a LOOKUP function where the result vector is showing an incorrect value, but only for a specific lookup vector. There are 66 rows in the table but only one row has the incorrect value.

1707899004611.png


1707899039824.png


The value are related to time.

Cheers
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
It seems to work for me. Not sure why you have the same value repeating in your lookup column though.
You may want to share your formula. It is pretty hard to debug when the forum doesn't have all the information.
Please use the xl2bb add in to share, the link to the add in is below.

Book1
ABCDE
100
26.7600
36.856.257.77
476.598.5
57.156.75
67.37
77.457.25
87.556.75
97.77
107.77
117.857.25
1287.5
1398.5
Sheet6
Cell Formulas
RangeFormula
E2:E4E2=LOOKUP(D2,$A$1:$A$13,$B$1:$B$13)
 
Upvote 0
If you really have time underlying those figures then the chances are that you have a rounding / precision issue.
If you have 365 why not use XLookup instead of Lookup and then you can put a rounding function around your lookup range and lookup value.

Using the awoohaw XL2BB data that he kindly provided in E2 something like this:
Excel Formula:
=XLOOKUP(ROUND(D2,5),ROUND($A$1:$A$13,5),$B$1:$B$13,,-1,1)
 
Upvote 0
It seems to work for me. Not sure why you have the same value repeating in your lookup column though.
You may want to share your formula. It is pretty hard to debug when the forum doesn't have all the information.
Please use the xl2bb add in to share, the link to the add in is below.

Book1
ABCDE
100
26.7600
36.856.257.77
476.598.5
57.156.75
67.37
77.457.25
87.556.75
97.77
107.77
117.857.25
1287.5
1398.5
Sheet6
Cell Formulas
RangeFormula
E2:E4E2=LOOKUP(D2,$A$1:$A$13,$B$1:$B$13)
Hi,

Thank you for the reply. I tested a smaller lookup on another tab in the spreadsheet and still had the same issue, however can provide more details on the formula etc as per your reply. Sorry I have not used xl2bb add in, i've moved to my Mac and can't seem to install it/

I have pasted the formula bar and as you can see by the highlighted cell, I'm still getting the same incorrect value. What i didn't put in my OP is that the "shift" value is a result of a formula.

H14=G14-F14

If i just type 7.7 into this cell, i actually receive the correct result vector of 7!


Screen Shot 2024-02-15 at 10.15.24 am.png
 
Upvote 0
Are H14 and G14 values or formulas? Have you expaned the number decimal to Maximum in all 3 cells?
 
Upvote 0
Are H14 and G14 values or formulas? Have you expaned the number decimal to Maximum in all 3 cells?
F14 and G14 are keyed values. i.e. F14 is shift start time and G14 is shift end time and H14 is the formula mentioned above, which gives the shift length time of 7.7 hours. Because this does not equate correctly, that is where i am using the lookup. I am only seeing this error with this particular lookup, as 6.7 and 8.7 give the correct result of 6 and 8 (hours) respectively.
 
Upvote 0
I've replicated your error. I even did a Match(K4:K34,H14,0) and MATCH(H14,K4:K35,0); and got all NA# errors. But, when I did H14=7.7 it resolved to TRUE.
This is quite a conundrum, my guess is that it is a floating decimal issue that happens. But, I am not expert on that nor know how to resolve other than using the ROUND function in your formula.
Excel Formula:
=LOOKUP(ROUND(H14,2),ROUND(K4:K35,2),L4:L35)



Book1
FGHIJKL
1
2
3
4#N/A#N/A0.00000000000000E+000.00000000000000E+00
5#N/A3.00000000000000E+003.00000000000000E+00
6#N/A3.15000000000000E+003.25000000000000E+00
7#N/A3.30000000000000E+003.50000000000000E+00
8#N/A3.45000000000000E+003.75000000000000E+00
9#N/A3.55000000000000E+003.25000000000000E+00
10#N/A3.70000000000000E+003.50000000000000E+00
11#N/A3.85000000000000E+003.75000000000000E+00
12#N/A4.00000000000000E+004.00000000000000E+00
13StartFinishShiftReturn#N/A4.15000000000000E+004.25000000000000E+00
148.30000000000000016.0000000000000007.70000000000000E+007.250000000000000#N/A4.30000000000000E+004.50000000000000E+00
15#N/A4.45000000000000E+004.75000000000000E+00
16#N/A4.70000000000000E+004.25000000000000E+00
17#N/A4.85000000000000E+004.50000000000000E+00
18#N/A5.00000000000000E+004.75000000000000E+00
19#N/A5.15000000000000E+005.00000000000000E+00
20#N/A5.30000000000000E+005.25000000000000E+00
21#N/A5.45000000000000E+005.50000000000000E+00
22#N/A5.70000000000000E+005.75000000000000E+00
23#N/A5.85000000000000E+005.25000000000000E+00
24#N/A6.00000000000000E+005.50000000000000E+00
25#N/A6.15000000000000E+005.75000000000000E+00
26#N/A6.30000000000000E+006.00000000000000E+00
27#N/A6.45000000000000E+006.25000000000000E+00
28#N/A6.70000000000000E+006.50000000000000E+00
29#N/A6.85000000000000E+006.75000000000000E+00
30#N/A7.00000000000000E+006.25000000000000E+00
31#N/A7.15000000000000E+006.50000000000000E+00
32#N/A7.30000000000000E+006.75000000000000E+00
33#N/A7.45000000000000E+007.00000000000000E+00
34#N/A7.70000000000000E+007.25000000000000E+00
35#N/A7.85000000000000E+007.50000000000000E+00
Sheet1
Cell Formulas
RangeFormula
I4I4=MATCH(H14,K4:K35,0)
J4:J35J4=MATCH(K4:K35,H14,0)
H14H14=G14-F14
I14I14=LOOKUP(ROUND(H14,2),ROUND(K4:K35,2),ROUND(L4:L35,2))
Dynamic array formulas.
 
Upvote 0
I've replicated your error. I even did a Match(K4:K34,H14,0) and MATCH(H14,K4:K35,0); and got all NA# errors. But, when I did H14=7.7 it resolved to TRUE.
This is quite a conundrum, my guess is that it is a floating decimal issue that happens. But, I am not expert on that nor know how to resolve other than using the ROUND function in your formula.
Excel Formula:
=LOOKUP(ROUND(H14,2),ROUND(K4:K35,2),L4:L35)



Book1
FGHIJKL
1
2
3
4#N/A#N/A0.00000000000000E+000.00000000000000E+00
5#N/A3.00000000000000E+003.00000000000000E+00
6#N/A3.15000000000000E+003.25000000000000E+00
7#N/A3.30000000000000E+003.50000000000000E+00
8#N/A3.45000000000000E+003.75000000000000E+00
9#N/A3.55000000000000E+003.25000000000000E+00
10#N/A3.70000000000000E+003.50000000000000E+00
11#N/A3.85000000000000E+003.75000000000000E+00
12#N/A4.00000000000000E+004.00000000000000E+00
13StartFinishShiftReturn#N/A4.15000000000000E+004.25000000000000E+00
148.30000000000000016.0000000000000007.70000000000000E+007.250000000000000#N/A4.30000000000000E+004.50000000000000E+00
15#N/A4.45000000000000E+004.75000000000000E+00
16#N/A4.70000000000000E+004.25000000000000E+00
17#N/A4.85000000000000E+004.50000000000000E+00
18#N/A5.00000000000000E+004.75000000000000E+00
19#N/A5.15000000000000E+005.00000000000000E+00
20#N/A5.30000000000000E+005.25000000000000E+00
21#N/A5.45000000000000E+005.50000000000000E+00
22#N/A5.70000000000000E+005.75000000000000E+00
23#N/A5.85000000000000E+005.25000000000000E+00
24#N/A6.00000000000000E+005.50000000000000E+00
25#N/A6.15000000000000E+005.75000000000000E+00
26#N/A6.30000000000000E+006.00000000000000E+00
27#N/A6.45000000000000E+006.25000000000000E+00
28#N/A6.70000000000000E+006.50000000000000E+00
29#N/A6.85000000000000E+006.75000000000000E+00
30#N/A7.00000000000000E+006.25000000000000E+00
31#N/A7.15000000000000E+006.50000000000000E+00
32#N/A7.30000000000000E+006.75000000000000E+00
33#N/A7.45000000000000E+007.00000000000000E+00
34#N/A7.70000000000000E+007.25000000000000E+00
35#N/A7.85000000000000E+007.50000000000000E+00
Sheet1
Cell Formulas
RangeFormula
I4I4=MATCH(H14,K4:K35,0)
J4:J35J4=MATCH(K4:K35,H14,0)
H14H14=G14-F14
I14I14=LOOKUP(ROUND(H14,2),ROUND(K4:K35,2),ROUND(L4:L35,2))
Dynamic array formulas.
Thank you. I'm glad it wasn't only me having this issue. :)
I will have a go at using the ROUND function.
 
Upvote 0
Thank you. I'm glad it wasn't only me having this issue. :)
I will have a go at using the ROUND function.
You're welcome. I reviewed some of the Floating Point Decimal documentation on the Excel web site. It can catch you in situations where you think it not problem. This is one of those circumstances.

Best wishes.
 
Upvote 0

Forum statistics

Threads
1,216,200
Messages
6,129,475
Members
449,511
Latest member
OttosArmy

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