Max Markin
Max Markin

Reputation: 11

Use "COLUMN" function on imported range Google Sheets

I am trying to find the location of the last non-empty cell in a row in a Google Sheet, and I've found several methods, but have been struggling to get any to work on imported data. I need to perform this function on a row in a different tab.

Can I use some variation of this method:

=MAX(ARRAYFORMULA(COLUMN(A2:2)*(--(A2:2<>""))))

on a range in a different tab? When I try using importrange in lieu of the ranges provided above, I get the error "Argument must be a range".

Here's what I'm trying

=MAX(ARRAYFORMULA(COLUMN(IMPORTRANGE("URL","tab!A2:2"))*(--( IMPORTRANGE("URL","tab!A2:2")<>""))))

Do I have a syntax error? Or can I not use a function like "COLUMN" on an imported range? Any ideas of a better way to do this in general?

Upvotes: 1

Views: 108

Answers (2)

player0
player0

Reputation: 1

try:

=MAX(INDEX(IF(IMPORTRANGE("URL", "tab!A2:2")="",, SEQUENCE(1, 10000)))

Upvotes: -1

Mike Steelson
Mike Steelson

Reputation: 15328

Try

=counta(importrange("URL","tab!A2:2"))

Upvotes: 1

Related Questions