I am pulling some values from get text and need to do sum but the values format is different. Some values in normal values and some values comes K.
Eg- 500,1k,200,300,2k
Total of above numbers is->4K.
Quick question when you read the data can you see how youa re getting it…this can be seen from locals panel after reading data into datatable…try using raw values option in use excel file
I believe this is the excel cell format and when you read you would get the data normally
@Anil_G , I just use excel to show you how the values comes and how I need output. Basically I pull all those values through Get Text activity and make the sum like in Excel.
Hi,
You can check for the existence of K in the value. If K is present, just replace it with nothing and convert the rest of the value to number format and multiply it by 1000. If K is not present you can simply add it to other numbers but make sure to convert it to number format if it is string.
So you can, check the value that you’re retrieving from get text activity, suppose you’re getting that in strData.
I’m creating a Amount Value of Double type.
also creating a variable called sum of double type
sum=0
if strData.toLower.contains(“k”)
then
Amount= CDbl(strData.toLower.replace(“k”,“”))*1000
sum=sum+amount
else
sum=sum+amount.
That way you can insert a numeric value in the excel.
Also the sum could be performed in the if condition itself.