# Help with If AND OR formula

#### abberyfarm

##### Well-known Member
Hi,

Could somebody help me with an IF, AND, OR formula please.

I have data for car journeys ike this:

Car registration in Col A, and Start and stop times etc.

Sheet1

 * A B C D E F G 1 Vehicle Start Date Start Time Stop Date Stop Time Parking time Parking time if next journey is on same day or next day only 2 10D14499 04/01/2011 08:01:08 04/01/2011 08:23:51 09:22:00 * 3 10D14499 04/01/2011 17:46:34 04/01/2011 18:15:12 13:46:54 * 4 10D14499 05/01/2011 08:02:06 05/01/2011 08:26:20 09:05:39 * 5 10D14499 05/01/2011 17:31:59 05/01/2011 18:06:10 14:10:15 * 6 10D14499 06/01/2011 08:16:25 06/01/2011 08:45:17 05:10:47 * 7 10D14499 06/01/2011 13:56:04 06/01/2011 14:10:31 01:19:41 *

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:75px;"><col style="width:70px;"><col style="width:75px;"><col style="width:69px;"><col style="width:85px;"><col style="width:388px;"></colgroup><tbody>
</tbody>

Excel tables to the web >> Excel Jeanie HTML 4

I want to work out the parking time in Col G if the next journey is on the same day or next day only for that car.

The car registration must be the same also. If the next journey is not on the same day or next day then leave it blank.

I though that it would be like this but it does not work

=IF(AND(A3=A4,OR(B3=B3,B3=B3+1)),f3,"")

Thanks

John

### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try this:
=IF(AND(A3=A4,OR(B4=B3,B4=B3+1)),F3,"")

Hello, thanks works perfect. Cheers

You are welcome!

Replies
4
Views
211
Replies
9
Views
136
Replies
5
Views
81
Replies
2
Views
277
Replies
1
Views
107

1,203,060
Messages
6,053,303
Members
444,650
Latest member
bookendinSA

### 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