If and or - so close..

Melimob

Active Member
Joined
Oct 16, 2011
Messages
396
Office Version
  1. 365
Hi all

I am so close yet so far with this.. looking for some help please.

Here's my formula
IF(AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"JOHN00",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"JOHN20",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"TYCO22",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"TYCO24")))),"Pre-Process",IF([@[Booking Date]]>=$AH$1,IF(AND([@[Booking Date]]>=$AH$1,AND(LEN([@[ARN-CDF10]]=9),LEFT([@[ARN-CDF10]],2)="TX",[@[ARN-CDF10]]<>"TX0000000",RIGHT([@[ARN-CDF10]],1)<>"/")),"OK","Error"),"Pre-Process"))

I want to add in an 'or' where the ARN-CDF10 can start with either TX, ME or GT. I got this to work but also need it to still always be 9 in length to be 'OK' and this is what I miss?

Any help would be appreciated please.

Many thanks
Melissa
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Untested...:confused:

Replace

LEFT([@[ARN-CDF10]],2)="TX"

With

OR(LEFT([@[ARN-CDF10]],2)="TX",LEFT([@[ARN-CDF10]],2)="ME",LEFT([@[ARN-CDF10]],2)="GT")

Perhaps...
IF(AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"JOHN00",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"JOHN20",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"TYCO22",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"TYCO24")))),"Pre-Process",IF([@[Booking Date]=]=>=$AH$1,IF(AND([@[Booking Date]=]=>=$AH$1,AND(LEN([@[ARN-CDF10]]=9),OR(LEFT([@[ARN-CDF10]],2)="TX",LEFT([@[ARN-CDF10]],2)="ME",LEFT([@[ARN-CDF10]],2)="GT"),[@[ARN-CDF10]]<>"TX0000000",RIGHT([@[ARN-CDF10]],1)<>"/")),"OK","Error"),"Pre-Process"))
 
Last edited:
Upvote 0
Thanks Yongle..

I tried this earlier. It works to say TX/GT/ME is 'OK' but doesn't test the length being 9 in each case and thats what I need it to also do :(

Untested...:confused:

Replace

LEFT([@[ARN-CDF10]],2)="TX"

With

OR(LEFT([@[ARN-CDF10]],2)="TX",LEFT([@[ARN-CDF10]],2)="ME",LEFT([@[ARN-CDF10]],2)="GT")

Perhaps...
IF(AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"JOHN00",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"JOHN20",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"TYCO22",AND([@[Booking Date]]<=$AH$1,[@[ Client ID ]]<>"TYCO24")))),"Pre-Process",IF([@[Booking Date]=]=>=$AH$1,IF(AND([@[Booking Date]=]=>=$AH$1,AND(LEN([@[ARN-CDF10]]=9),OR(LEFT([@[ARN-CDF10]],2)="TX",LEFT([@[ARN-CDF10]],2)="ME",LEFT([@[ARN-CDF10]],2)="GT"),[@[ARN-CDF10]]<>"TX0000000",RIGHT([@[ARN-CDF10]],1)<>"/")),"OK","Error"),"Pre-Process"))
 
Upvote 0
Like I said, I did not test your original formula. I did not spot this earlier but...

shouldn't
LEN([@[ARN-CDF10]]=9)
be
LEN([@[ARN-CDF10]])=9
 
Last edited:
Upvote 0
Wow! how did you spot that! thank you so much Yongle! worked a treat!

Like I said, I did not test your original formula. I did not spot this earlier but...

shouldn't
LEN([@[ARN-CDF10]]=9)
be
LEN([@[ARN-CDF10]])=9
 
Upvote 0
It's a dark art...:eeek:
thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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