Find Specific Instance of Characters within a String and Return "This" Result

censo

Board Regular
Joined
Dec 25, 2015
Messages
161
Office Version
  1. 2013
Platform
  1. Windows
Greetings,

I have a need to identify a specific set of characters "VQTY" within a string and return the result "89752".

Requirements:

- The returned value of "89752" will be static and always remain the same
- Regular instance of "QTY" (without the "V") should return nothing (cell remains blank)
- The number following "QTY" is irrelevant and should be ignored
- The instance of "VQTY" can appear anywhere within the string and the string varies in length

Below are some example of positive hits and the correct result when the criteria is not met (blank cells)

With the help of the community on a previous project I was working, the following function was created that may provide assistance on how to properly find the instance I'm looking to isolate (the calculation does not apply here, just the segment that helps identify the set of characters that will yield a match)

Code:
=LEFT(SUBSTITUTE(MID(A1&""-QTY1-"",FIND(""-QTY"",A1&""-QTY"")+4,9),""-"",REPT("" "",9)),9)*A2

Book1
AB
1VALUERESULT
2ABC-12345
3ABC-12345A
4ABC-12345-QTY2
5ABC-12345-QTY2
6ABC-12345-VQTY289752
7ABC-12345-QTY8
8ABC-12345C
9ABC-12345-QTY9
10ABC-12345-VQTY1089752
11ABC-12345-QTY11
12ABC-12345-VQTY1289752
Sheet1
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi,

Like this:


Book1
AB
1VALUERESULT
2ABC-12345 
3ABC-12345A
4ABC-12345-QTY2
5ABC-12345-QTY2
6ABC-12345-VQTY289752
7ABC-12345-QTY8
8ABC-12345C
9ABC-12345-QTY9
10ABC-12345-VQTY1089752
11ABC-12345-QTY11
12ABC-12345-VQTY1289752
Sheet299
Cell Formulas
RangeFormula
B2=IF(ISNUMBER(SEARCH("VQTY",A2)),89752,"")
 
Upvote 0
The solution works the exactly way I needed it to. Thanks so much!
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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