# Negative time result given using INDEX and MATCH (when it should be zero)

#### Seven lucky logs

##### New Member
Hi Gents,

Excel 2012
ABCDEFGHI
1-0.208331.50
2StartEndA-0.20833
308:0017:15-5
5
6StartEndB
708:0017:30-5
8
9A
10StartStartEndStatusBuffer / Over limits
1100:0011:0001:3003:0012:15Within limits by00:15
1200:0511:00
1300:1011:00B
1400:1511:00StartStartEndStatusBuffer / Over limits
1500:2011:0001:3003:0012:30Within limits by########################
1600:2511:00
1700:3011:00
1800:3511:00
1900:4011:00
2000:4511:00
2100:5011:00
2200:5511:00
2301:0011:00
2401:0511:00
2501:1011:00
2601:1511:00
2701:2011:00
2801:2511:00
2901:3011:00
Time different from GMT
Cell Formulas
RangeFormula
H1=F3/24
H2=F3/24
C11=D11-\$I\$1/24
C15=D15-\$I\$1/24
D11=IF(D3="","",D3+\$H\$1+(D3>E3))
D15=IF(D7="","",D7+\$H\$2+(D7>E7))
E11=IF(E3="","",E3+\$H\$1+(D3>E3))
E15=IF(E7="","",E7+\$H\$2+(D7>E7))
F11{=IF(C11="","",IF(INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C11,10),ROUND(\$A\$11:\$A\$298,10)+(C11>E11),0))>=((E11-C11)+(C11>E11)),"Within limits by","Exceeds Max FDP by"))}
F15{=IF(C15="","",IF(INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C15,10),ROUND(\$A\$11:\$A\$298,10)+(C15>E15),0))>=((E15-C15)+(C15>E15)),"Within limits by","Exceeds Max FDP by"))}
G11{=IF(F11="Exceeds Max FDP by",((E11-C11)+(C11>E11))-INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C11,10),ROUND(\$A\$11:\$A\$298,10)+(C11>E11),0)),IF(F11="Within limits by",INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C11,10),ROUND(\$A\$11:A298,10)+(C11>E11),0))-(E11-C11)+(C11>E11),""))}
G15{=IF(F15="Exceeds Max FDP by",((E15-C15)+(C15>E15))-INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C15,10),ROUND(\$A\$11:\$A\$298,10)+(C15>E15),0)),IF(F15="Within limits by",INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C15,10),ROUND(\$A\$11:A302,10)+(C15>E15),0))-(E15-C15)+(C15>E15),""))}
Press CTRL+SHIFT+ENTER to enter array formulas.

Column A continues down to "23:55" in cell A298. Column B continues down to B298 and holds various values between "11:00" and "14:00" depending on time in column A.

The top range denoted with an "A" is linked to the third range again with an "A" and this shows that the formulae are working. The second set of linked ranges show a negative value when, by my manual working, it should be zero. The problem is only when the result should be zero; if the result should be over, it is and is shown correctly. Likewise for results that should be under. Am I rounding too much?

I'm designing (hopefully) a tool to calculate working hours for aircrew by entering flight times in GMT and adjusting the time zone to suit.

Many thanks for any ideas
Tim

### Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

#### Seven lucky logs

##### New Member
Hi,

I think the problem lies in the bold section below but can't see how it can INDEX/MATCH correctly in all instances except when the two figures are equal.

{=IF(F11="Exceeds Max FDP by",((E11-C11)+(C11>E11))-INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C11,10),ROUND(\$A\$11:\$A\$298,10)+(C11>E11),0)),IF(F11="Within limits by",INDEX(\$B\$11:\$B\$298,MATCH(ROUND(C11,10),ROUND(\$A\$11:A298,10)+(C11>E11),0))-(E11-C11)+(C11>E11),""))}

However, I'm still not sure whether I need the = next to the > in the F column array formulae. It doesn't seem to make a difference either way.

As before, any help would be appreciated.

Replies
0
Views
244
Replies
12
Views
275
Replies
4
Views
138
Replies
3
Views
229
Replies
6
Views
218

### Forum statistics

1,195,671
Messages
6,011,075
Members
441,581
Latest member
rp4717 ### 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.

### Which adblocker are you using?    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

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