With the new Extract expressions, are we currently able to extract a fraction from text?

# EXTRACT - Can we Extract a fraction from text currently?

Hi Levent, no problem. I have recipes downloaded that provide a full line of text for the required ingredients:

1/2 cup of whole milk

1 tsp of salt

etc.

Iâ€™m not so clear what or what part do you want to extract from your provided example

Need to extract the fraction from the text:

For â€ś1/2 cup of whole milkâ€ť

the result should be â€ś1/2â€ť

Iâ€™ll give it try! Thanks Levent

Iâ€™m sure you are probably already aware of this article describing the EXTRACT() function, but just in case I have included it below.

It does not mention or hint that it can extract fractional text. But I wonder if the DATES specifier might work since the fractions you are likely to encounter could also be Dates without the year? Havenâ€™t tried so not sure.

@LeventK solution is perfect, IF you know the fractions will always be the first â€śwordâ€ť in the text.

Yes - I was hoping EXTRACT() already had the capability Thanks John!

@Daisy_Ramirez

Provided it is not a must to write it as fractions (1/2), provided you write them as decimals (1.5), you can use this:

Nope.

In the case of a recipe app where you want common fractions to show up (i.e. 1/4, 1/2), maybe you could create a helper table which relates the decimal format to the fractional format, and utilize SUBSTITUTE()? this may simplify some of the formatting challenges you could encounter.