 # Applying formula basis of context/Sting

Hi,

I have set of formula/formulas for extracting particular data sting from the data set. However i require help in applying multiple formula basis of string contained in data set for extraction.

``````Data Set > Contains string > Formula 1+Formula 2 > Result
``````

A1 > ABC/23902983109/ASDJCNKS@YD (Data set) > ABC(String) > IF(SEARCHB(“ABC/”,A1,1),“ABC”) - Formula > ABC (End Result)

A2 > MB/NEFT DR/XYZ/SDSDC098098/DD > NEFT DR(sting) > IF(SEARCHB("/NEFT DR/",A2,1),MID(A2,12,100)) + LEFT(A2,FIND("/",A2)-1) > XYZ(End Result)

A3 > DCSD CHARGES > CHARGES(String) > IF(SEARCHB(“Charges”,A3,1),“Charges”) > Charges (End Result).

Sorry. I cannot find a clear question. I therefore just guess the central point is that you want to split a compound in parts for further processing.
Splitting compounds as needed always depends on a clear and unambiguous syntax. The context should be uncomplicated and may be checked after the split itself. Assuming your compounds are formed with the two alternative separators ` `(space) and `/`, I would suggest you start splitting it based on this alternative.
With LibO V62. or higher one of the usable means is the REGEX() function. To avoid unreasonably complicated formulas the alternative might be a user function based on (e.g.) the Basic function `Split()`.
The attached spreadsheet demonstrates the first way.

Hi,

Thanks for the revert, the question here is, for example I have 20 types of of data set and in each data set different data needs to be extracted basis of key words in the data set.

Regards
Bhargava

Yes, so far I understood the question. I didn’t get to more detail.
Since I wouldn’like to have three independently designed formulas (needing extra maintenance/enhancement once in a while) for very different purposes, I would try to design a concept basically solveing all the cases.
Generally the `REGEX()` function can extract a single specific part of a string in many cases. You only need to adapt the arguments.
Clearer: `I have` ==>> `I want to get`.