HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The VLOOKUP function is a premade function in Google Sheets, which allows searches across columns
The VLOOKUP function is a premade function in Google Sheets, which allows searches across columns.
It is typed =VLOOKUP
and has the following parts:
=VLOOKUP(search_key, range,
index, [is_sorted])
Note: The column which holds the data used to lookup must always be to the left.
Note: Both 1 / 0 and True / False can be used in [is_sorted].
Let's have a look at an example!
Lookup and return Pokemon names from this list by their ID#:
The VLOOKUP function, step by step:
H4
=VLOOKUP
H4
is where the search result is displayed. In this case, the Pokemon's names based on their ID#.
H3
)H3
selected as serach_key. This is the cell where the search query is entered. In this case the Pokemon's ID#.
,
A2:E21
,
2
TRUE
In this example the table is sorted by ID#, so the [is_sorted] value is TRUE
.
An illustration for selecting column index number 2
:
Now, the function returns the Name value of the search_key specified in cell H3
:
#N/A
value. This is because there have not been entered any value to the Search ID# cell H3
.
Let us feed a value to it, type 7
into cell H3
:
7
.
One more time, type 4
into cell H3
:
4
as its ID#. That's great.
Let's try another example, using the Pokemon names as input instead.
First, change the places of columns A and B.
Note: You can click and drag coloumns in Google Sheet to rearrange them.
Clicking and holding coloumn A and dragging it between columns B and C will rearrange them like this:
Now, the function is trying to look up 4
in the Name column, which returns the #N/A
error.
Let's switch the labels, and try to enter Caterpie
into the cell H3
, where the vlookup functions finds the search_key:
Notice that the ID# returned is 1, although Caterpie's ID# is actually 10.
This result is another error.
This is because the Name values are not sorted like the ID numbers are.
Let's change the value of the [is_sorted] part of the function from TRUE to FALSE:
Now, the function correctly returns Caterpie's real ID number:
function copyFormulas(elementId){ /* Get the text field */ var copyText = document.getElementById(elementId); /* Select the text field */ copyText.select(); copyText.setSelectionRange(0, 99999); /* For mobile devices */ /* Copy the text inside the text field */ navigator.clipboard.writeText(copyText.value) .then(() => { alert('Range copied to clipboard.\nIt can now be pasted into the Google Sheets spreadsheet.') }) .catch((error) => { alert(`Copy failed! ${error}`) }) }