Possible to nest OR() within FIND() and REPLACE()?

rca

Board Regular
Joined
Mar 1, 2005
Messages
182
Hi All,

I have the following formula:

=IF(OR(MID(D3,4,3)="ABC",MID(D3,5,3)="ABC"), REPLACE(D3,FIND("ABC",D3)+4,2,VLOOKUP(MID(D3,FIND("ABC",D3)+4,1),{"H","M";"M","U";"U","Z";"Z","H"},2,FALSE)&MID(D3,FIND("ABC",D3)+5,1)+(MID(D3,FIND("ABC",D3)+4,1)="Z")), IF(OR(MID(D3,4,3)="CAM",MID(D3,5,3)="CAM"),REPLACE(D3,FIND("EMC",D3)+4,2,VLOOKUP(MID(D3,FIND("EMC",D3)+4,1),{"H","M";"M","U";"U","Z";"Z","H"},2,FALSE)&MID(D3,FIND("EMC",D3)+5,1)+(MID(D3,FIND("EMC",D3)+4,1)="Z")), "Error!"))

I'd like to be able to test for another condition within:

REPLACE(D3,FIND("EMC",D3)+4

Ideally, I'd like it to be:

REPLACE(D3,FIND(OR("EMC","HLC"),D3)+4

(testing for "EMC and "HLC")

Is that possible?

Thanks!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,892
Hi


FIND(OR("EMC","HLC"),D3)

In case you find both "EMC" and "HLC" in D3 which result do you want?
 
Upvote 0

rca

Board Regular
Joined
Mar 1, 2005
Messages
182
Hi


FIND(OR("EMC","HLC"),D3)

In case you find both "EMC" and "HLC" in D3 which result do you want?

To answer your question, the value in cell D3 will contain either "EMC" or "HLC" (but not both values).
 
Upvote 0

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,892
In that case, if the text in D3 contains either "EMC" or "HLC" you can find its postion in the text with:

=LOOKUP(LEN(D3),FIND({"EMC","HLC"},D3))
 
Upvote 0

Forum statistics

Threads
1,191,184
Messages
5,985,175
Members
439,945
Latest member
ospe

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
Top