IF, and LEFT, with wildcards...

Tomkat53

Board Regular
Joined
Oct 22, 2010
Messages
61
Greetings...
I have a formula that ALMOST works...
I need it to look at the LEFT 5 characters in Column C (label_description), and if they match the format "*** - *" then I need it to return just the first 3 characters.
If it's false, I need it to return "OB" & the RIGHT 3 characters from column A (label_code)
The problem is, I'm having difficulty getting the wildcards to work properly. Apparently "IF" cannot use wildcards, but COUNTIF can, so I have to combine them as follows...

1640017782091.png


As you can see the formula works until row 45... it WANT IT to return "OB506" but it returns "Car" because column C contains "*** - *" (where indicated by red rectangle.)
HOW do I get the formula to ONLY consider the LEFT 5 characters?
I have searched for a solution for quite awhile, but I seem to be running in circles.
I have hundreds of records in this table, and would really like to not have to "fix" each record manually.
 

Attachments

  • 1640017350738.png
    1640017350738.png
    48.9 KB · Views: 5
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,215,527
Messages
6,125,333
Members
449,218
Latest member
Excel Master

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