Cj A
Cj A

Reputation: 11

IMPORTXML value returned price NOT as number - need help to convert

Not an expert in Google sheet so would appreciate if someone can help me solve this:

trying to do some work on crypto pricing. I extract the actual price this way CELL I2 has something like https://coinmarketcap.com/currencies/AAVE If I use formula =IMPORTXML(I2,"//div[@class='priceValue ']") It will return the price value of the I2 crypto in this case for example $320.12 It seems the 320.12 is text and I could not convert to number using VALUE(I2)

I need to use this 320.12 to calculate ... for example I try to multiply the 320.12 by the quantity and I get the error: Function MULTIPLY parameter 1 expects number values. But '$320.12' is a text and cannot be coerced to a number.

Appreciate the help

Upvotes: 1

Views: 1101

Answers (2)

player0
player0

Reputation: 1

use:

=1*REGEXEXTRACT(IMPORTXML(I2, "//div[@class='priceValue ']")&"", "\d+.\d+|\d+")

Upvotes: 1

Mike Steelson
Mike Steelson

Reputation: 15328

No the value is a number formatted in $, you can use it ... see https://docs.google.com/spreadsheets/d/1cgb8D01AR7Zy6FVjYcVtJkNk1lEtRC7V_UvjcF283qA/edit?usp=sharing enter image description here

Upvotes: 0

Related Questions