How to extract percentage from BM table

I have data in the following format. When I extract it to a text or Excel file, it gets stored in a single cell. I need to validate whether the returns are 100% based on the time period. If the returns are exactly 100%, I should mark it as ‘Pass’; otherwise, it should be ‘Fail’. I was able to extract the percentage after ‘Return USD’ using line-by-line reading with regex. However, I am unable to extract the data based on the time period. Could you please help me with this?

Before reading data

after reading and extract data to txt or excel

Time Period BMK
2025-02-05 - 2025-02-15 S&P 500 return USD 30%
Bloomberg zyd 500 return USD 25%
Blk MUCCSS return USD 30%
US smallCAP return USD 15%
2024-01-31 - 2025-02-15 S&P 500 return USD 10%
Bloomberg zyd 500 return USD 25%
Blk MUCCSS return USD 40%
JAPAN INDex return USD 25%
2020-12-31 - 2024-01-31 Bloomberg 500 return USD 3%
S&P 500 return USD 40%
MCCI Net index return USD 7%
UTC Gross return USD 50%

Hi @Raghu_km

Can you try generate datatable from text activity

Hope this helps

I appreciate your advice. But how is it going to work? I can’t extract the data into columns as it is stored in a single cell. How can we segregate all the cell data based on the time period? Can you create a workflow for this?

Hi @Raghu_km

Can you try the below

Output:

Sequence2.xaml (15.3 KB)

Regards,

1 Like

I sincerely appreciate your support. Your solution was very helpful!

Just a small correction—if the date is in the following format instead of numeric:

Jun 30 2024 - Jan 31 2025

What would be the correct regex for this format?

Thank you in advance!

@Raghu_km

Try this

((\w+(\s+|-)\d+(\s+|-)\d+ - \w+(\s+|-)\d+(\s+|-)\d+.*\s+)\w+.*\s+\w+.*\s+\w+.*)

Regards,

I tried this its not working, where exactly i need to paste. please let me know.

@Raghu_km

Try this

Sequence2.xaml (15.3 KB)

Output:

Regards,

Thank you for your time. It is working if the data is the same. However, if the data varies, the total return giving 200% instead of 100 (Refer-1).
We have different types of accounts, and the data will vary. Some accounts may have only one entry (Refer-2).

Sometimes, the data can be extensive, containing more than 16 or 17 lines. Additionally, within the same period, you may see more than 5-6 indices contributing returns on same period(Refer-3)

Refer-1
benchmakdetails
Time Period BMK
Jun 30 2024 - Jan 31 2025 HDFC Bank return USD 100%
Jun 30 1958 - Jun 30 2025 ICC Bank return USD 100%

Refer-2
benchmakdetails
Time Period BMK
Jun 30 2024 - Jan 31 2025 HDFC Bank return USD 100%

Refer-3
benchmakdetails
Jan 31 2023 - Dec 31 2024 Axex 500 return USD 50%
N&P 500 return USD 40%
MCCC Net index return USD 5%
ITC Gross return USD 5%
Aug 31 2000 - Jan 31 2023 S&P 500 return USD 15%
Bloomberg zyd 500 return USD 5%
Blk MUCCSS return USD 10%
UR smallCAP return USD 10%
Blk MUCCSS return USD 10%
JAPAN INDex return USD 10%
Axex 500 return USD 10%
HDFV 500 return USD 10%
SBI 500 return USD 20%

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.