1

So I am fetching some data using ImportJSON, it's a transaction history search from BSCSCAN, I get the data into my sheet and I want to separate my buys and sells. One column has an output like this...

swapETHForExactTokens(uint256 amountOut, address[] path, address to, uint256 deadline)

This is a buy using BNB, I want to find all of these, then add up the numbers from another column.

data

So I want to look through column V find all the buys that used BNB and then add up all the corresponding amounts from column K.

I'm using this...

=SUMIF(V2:V21,"swapETHForExactTokens",K2:K21)

I have tried many variations, trying different wild cards and such but no luck, it always returns 0, I have tried using SUMIF on another sheet with some basic data that I entered and it works fine, so my only thought is that it doesn't like the data format coming in from the JSON call?

Any help would be greatly appreciated.

EDIT: Definitely something to do with the data, I tried this... As you can see, in row 11 I just hardcoded to data, that was seen by SUMIF.

enter image description here

1

1 Answer 1

1

Try this:

=sum(filter(K2:K21, regexmatch(V2:V21, "swapETHForExactTokens")))

OR

=sumif(V2:V21,"*swapETHForExactTokens*",K2:K21)

The point is that you are trying to match part of the string, hence regexmatch or the wildcard asterisks in the sumif.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.