Ajeet Ganga
Ajeet Ganga

Reputation: 8653

How to refer table column by column heading/name in google sheet

(I might have used wrong terminology to frame question, and it would be great to be pointed at right question/answer.)

As shown in image I have a table. I want to sum all the values in "col2"

One way to do this is

=sum(B2:B4)

But I think a cleaner way to do this would involve somehow referring the column name in the formula, so that formula is more readable.

Is there a way to do it?

enter image description here

Upvotes: 1

Views: 1968

Answers (3)

Mike Steelson
Mike Steelson

Reputation: 15328

Try

=SUM(offset(A2:A,,MATCH("Col2",1:1,0)-1))

enter image description here

Upvotes: 1

z..
z..

Reputation: 13156

You could try this too

=sum(filter(A2:C4,A1:C1="col2"))

enter image description here

Upvotes: 1

Nikko J.
Nikko J.

Reputation: 5543

Try this formula:

=SUM(INDIRECT("C"&MATCH("col2", 1:1, 0),FALSE))

Output:

enter image description here

References:

Upvotes: 0

Related Questions