Google Sheets公式问题:无法引用单元格日期获取比特币价格
The issue here is that the CRYPTOFINANCE function doesn’t natively accept an array of dates as its third parameter—when you pass $C$2:$C directly in your ARRAYFORMULA, it tries to send the entire range as a single value, which the function can’t interpret correctly.
Instead, use BYROW (a modern Google Sheets function) to iterate over each row individually, calling CRYPTOFINANCE with the corresponding date from column C for each non-blank entry in column B. Here’s the working formula:
=BYROW($B$2:$C, LAMBDA(row, IF(ISBLANK(INDEX(row, 1)), "", CRYPTOFINANCE("BTC/USD", "price", INDEX(row, 2)))))
How this works:
BYROW($B$2:$C, ...): Processes each row in the range B2:C one at a time.LAMBDA(row, ...): Creates a custom function that takes each row as input.INDEX(row, 1): Grabs the value from column B in the current row (to check if it’s blank).INDEX(row, 2): Grabs the corresponding date from column C in the current row, passing it toCRYPTOFINANCEas a single, valid date value.
Pre-check to avoid issues:
Make sure column C is formatted as a Date (not plain text). To do this:
- Select column C
- Go to
Format > Number > Date
This ensures Google Sheets recognizes the values as valid dates that CRYPTOFINANCE can process correctly.
内容的提问来源于stack exchange,提问作者Bocho Todorov

