HomeGoogle DocsSpreadsheetHow to Return an Entire Column in Hlookup in Google Sheets

How to Return an Entire Column in Hlookup in Google Sheets

Published on

In your horizontal dataset, you may want to use Hlookup to return an entire column’s content. Is it possible? Yes! It is possible in Google Doc Spreadsheets. See How to return an entire column in Hlookup in Google Sheets.

Spreadsheet users are not in favor of the row-wise/horizontal data formatting. Normally column-wise/vertical dataset is easy to handle. Also, most of the functions in Google Sheets are well supported in using a vertical dataset.

But you may have your data horizontally arranged and that may be due to the data imported from some other source or the data is stored as part of form submission. In such datasets, if you want to look up a value, you can use Hlookup.

As I’ve stated above, the function Hlookup is capable of returning an entire column value in the output. See how to do that in the example formula below.

Example: How to Return an Entire Column in Hlookup in Google Sheets

Sample Data:

Lookup a Search Key and Return an Entire Column

Note: The above data is sourced from this Wiki page using the following IMPORTHTML function.

=transpose(query(importhtml("https://en.wikipedia.org/wiki/List_of_waterfalls_by_height","table",2),"Select Col1, Col2, Col3, Col4 limit 10"))

First, understand the data. In this dataset, the first row contains the names of some of the waterfalls in the world.

In the second row, you can find its height, in the third row the locality of the waterfall and in the fifth row the country it resides.

I want to look up one ‘Waterfall’ by its name in the first row and return the details such as height, locality, and country.

The Formula that Returns an Entire Column in Hlookup in Google Sheets

Search_Key: “James Bruce Falls”

Formula:

=ArrayFormula(hlookup("James Bruce Falls",A1:J4,{2;3;4},false))

This formula searches across the first row and successfully finds the search_key in J1. It returns the values from rows 2, 3 and 4. The values are in row-wise. So use the semicolon instead of the comma as the separator.

The row indexes are inside the Curly Brackets and the formula would return an array result. So we should use the function ArrayFormula to wrap the Hlookup formula.

Hlookup with Entire Column Result (Formula Modification)

To return an entire column result in Hlookup, I mean infinite range, replace{2;3;4} (index) in the above formula withrow(A2:A).

=ArrayFormula(IFERROR(hlookup("James Bruce Falls",A1:J4,row(A2:A),false)))

Please note the following points.

  1. You must use Iferror with Hlookup to remove #REF! error in such an open (infinite) range.
  2. Also, use the formula outside the Hlookup range like in cell K1 or L1 as up to column J are occupied in the formula.

The ROW function returns the necessary multiple index numbers 2,3,4… when using within the ArrayFormula.

The same approach you can use in Vlookup but there replace the function ROW with the function COLUMN.

That’s all. Hope you could understand how to return an entire Column in Hlookup in Google Sheets. Enjoy!

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.