EXTRACT - Can we Extract a fraction from text currently?

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

Can you exemplify?

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


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”

How about

		" "
1 Like

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 :slight_smile: Thanks John!

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:

1 Like


1 Like

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.