Forum Discussion
Converting google sheets formula to excel
- Aug 11, 2022
I agree with HansVogelaar that a sample sheet would be helpful but I do see a couple things:
=IFERROR( IF(VLOOKUP(B4,FILTER({$B$3:$B3,$I$3:$J3},$B$3:$B3=B4),2,1)>0, ROUNDDOWN((SUM($I$3:$I3))*1%,1), IF(VLOOKUP(B4,FILTER({$B$3:$B3,$I$3:$I3},$B$3:$B3=B4),2,2)<0, VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),8,1)*-2, IF(VLOOKUP(B4,FILTER({$B$3:$B3,$I$3:$I3},$B$3:$B3=B4),2,2)=0, VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),2,1)*1 ) ) ) )
so I think the problem is the FILTER({...} ...
you can't create a set of ranges like that. Just filter the entire range and pick the column accordingly. I also tried to simplify the whole equation by checking the sign of that result instead of <0, =0 and >0:
=IFERROR( CHOOSE(SIGN(VLOOKUP(B4,FILTER($B$3:$J3,$B$3:$B3=B4),8,1))+2, VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),8,1)*-2, VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),2,1)*1, ROUNDDOWN((SUM($I$3:$I3))*1%,1) ), "error" )
that said there are a couple other things I question:
a) in the VLOOKUPs the last parameter was a 2 in a couple cases when that is really a true/false but I assume any value will come back the same as true
b) in the <0 case you are returning a lookup from column I (3rd parameter is 😎 but the =0 case you are returning from column C (3rd parameter is 2), is that supposed to be an 8 also?
c) you have an IFERROR() but I didn't see it being used so I added a "error" statement because excel doesn't allow nothing (but apparently sheets does)
That's a long formula; it's hard to visualize what it does. Could you attach a sample workbook (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar? Thanks in advance.
I agree with HansVogelaar that a sample sheet would be helpful but I do see a couple things:
=IFERROR(
IF(VLOOKUP(B4,FILTER({$B$3:$B3,$I$3:$J3},$B$3:$B3=B4),2,1)>0,
ROUNDDOWN((SUM($I$3:$I3))*1%,1),
IF(VLOOKUP(B4,FILTER({$B$3:$B3,$I$3:$I3},$B$3:$B3=B4),2,2)<0,
VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),8,1)*-2,
IF(VLOOKUP(B4,FILTER({$B$3:$B3,$I$3:$I3},$B$3:$B3=B4),2,2)=0,
VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),2,1)*1
)
)
)
)
so I think the problem is the FILTER({...} ...
you can't create a set of ranges like that. Just filter the entire range and pick the column accordingly. I also tried to simplify the whole equation by checking the sign of that result instead of <0, =0 and >0:
=IFERROR(
CHOOSE(SIGN(VLOOKUP(B4,FILTER($B$3:$J3,$B$3:$B3=B4),8,1))+2,
VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),8,1)*-2,
VLOOKUP(B4,FILTER($B$3:$I3,$B$3:$B3=B4),2,1)*1,
ROUNDDOWN((SUM($I$3:$I3))*1%,1)
),
"error"
)
that said there are a couple other things I question:
a) in the VLOOKUPs the last parameter was a 2 in a couple cases when that is really a true/false but I assume any value will come back the same as true
b) in the <0 case you are returning a lookup from column I (3rd parameter is 😎 but the =0 case you are returning from column C (3rd parameter is 2), is that supposed to be an 8 also?
c) you have an IFERROR() but I didn't see it being used so I added a "error" statement because excel doesn't allow nothing (but apparently sheets does)
- 4ll5opAug 11, 2022Copper ContributorOk, this formula seems to fix it so thank you, 3rd paramter is meant to be different for =0 & >0
i will continue to enter data and test the formula but i think you have cracked it from what ive tested so far.
Thank you - DCLarson115Jun 29, 2024Copper Contributor
Good Day,
Looking for advise on changing a =googlefinance formula to work in excel with out the dummy function conversion.
The google finance formula is for a 52 week performance of a stock that will only use one cell.
=GOOGLEFINANCE(A2,"price") / index(GOOGLEFINANCE(A2,"price", datevalue(today()-365) ) , 2,2) - 1
it has A2 to refer to the ticker in A2 cell,so i can use it in a table. "A2 is currently the ticker COIN"
When I save as an excel file it shows the following and is no longer a percentage value.
=IFERROR(@__xludf.DUMMYFUNCTION("IFERROR(ROUND((GOOGLEFINANCE(A2, ""price"")/index(GOOGLEFINANCE(A2,""open"",datevalue(today()-365)), 2,2)- 1)*100,2))"),262.86)
My understanding of excel VBA is a novice by I am getting a little better day by day.
Thank you
Derik
@ links to members
- SergeiBaklanJun 29, 2024MVP
As variant
=TAKE( STOCKHISTORY([@Ticker],TODAY()-10,TODAY(),0,0,1 ), 1) / TAKE( STOCKHISTORY([@Ticker],TODAY()-375,TODAY()-365,0,0,1 ), 1)
- serb1cash-bbsrOct 02, 2024Copper Contributor
=MIN(INDEX(GOOGLEFINANCE(A2,"ALL",TODAY()-180,TODAY()),0,5))*1.2