XLOOKUP for dog records: 4 steps from lookup to return
BiscuitHare Editorial Team ·
Use XLOOKUP to search a dog's name in one column and return its matching details from another column.
Key takeaways
- Give each dog its own row.
- Put the name to search in I2.
- Match the lookup and return ranges.
- Test the results before sharing the sheet.
If your household keeps one shared spreadsheet for the dog, you probably already have most of what you need. There is a row for each dog, a column for the breed, another for the vet, one for the next vaccine date, and a long column of notes that somebody added last spring and nobody has read since. The sheet keeps everything in one place, which is the whole point. It is less useful when you want one dog's details in a hurry. Scrolling works for a short list, and sorting gives you a quick glance, but neither gives you a clean answer to the question "what is Otis's vet's phone number?"
A lookup formula fixes that. You type a name in one cell, and the matching details appear in another cell. Once it is set up, anyone in the house can use it, including a dog sitter who has never seen the sheet before. You do not need to know how the sheet is organized, and you do not need to scroll.
This post walks through the setup in four steps. The formula at the center is XLOOKUP, a function in Microsoft Excel. It searches one column for a value you give it, then returns the matching entry from a column you choose. Everything here uses one made-up household with four dogs: Biscuit, Juniper, Maple, and Otis. Swap in your own dogs and column names as you go. For related layouts, see dog care spreadsheets.
Check your spreadsheet version first
Before you build anything, find out which program and version the people who share the file will use. Microsoft's help page on XLOOKUP notes that you may come across a workbook in Excel 2016 or Excel 2019 that contains the function, if someone else created it in a newer version of Excel. Microsoft, XLOOKUP function That can happen in a household when one person builds the sheet on a new computer and another opens it on an older one. Test the formula on the oldest version anyone in the house uses before you count on it.
If you use a different spreadsheet program, the four steps still describe the same idea: a lookup cell, a formula that searches a names column, and a column to return the answer from. Look in that program's help pages for its own lookup function and its own way of writing the formula.
Step 1: Set up a row for each dog
Start with a single sheet and put the headings in row 1. Then add one row for each dog, below the headings. Here is the layout used in this post:
| Name | Breed | Birthday | Vet | Next vaccine | Microchip | Notes |
|---|---|---|---|---|---|---|
| Example | illustrative breed | illustrative birthday | illustrative clinic | illustrative vaccine date | illustrative chip identifier | illustrative care note |
Column A holds the names, column B the breeds, and so on across to column G. The layout is simple on purpose. A lookup works best when each column holds one kind of information and each row holds one dog. A few rules keep it that way:
- No shared rows. If two dogs share a row, the lookup has no way to tell which details belong to which dog.
- No merged cells inside the table. Merged cells look tidy, but they make it harder to copy a formula down a column and harder to read the ranges later.
- Names in column A. This is not a strict requirement, but it keeps the formula easy to read. The names sit on the left, and the details run to the right.
- No blank rows in the middle. Add each new dog at the bottom, directly under the last one. A gap can make it unclear where the table ends.
- One spelling for each name. A lookup only finds the text it is given. If one row says Biscuit and another has a stray letter or a missing letter, a search for Biscuit will not find the second row. Pick the spelling you will type and use it everywhere, including in the notes column.
- Microchip numbers as text. Long numbers can change form when a program treats them as math. A number you copied in can end up different from the one on the paperwork. Check the entry against the paperwork after typing it.
Keep the table free of gaps as it grows. The formulas in step 3 are written to cover whole columns; test a dog added at the bottom to confirm its details appear. That means you do not have to plan for a maximum number of dogs. The main thing is to keep each new dog on the next empty row, so the table stays continuous.
It also helps to fill in every cell you can, even if the entry is short. A blank vaccine date looks the same as a forgotten one, and a sitter reading the card may not know which it is. If a detail does not apply to a dog, write "none" so the blank means something.
Step 2: Put the name you want in one lookup cell
Choose a cell outside the table where the name will be typed. In this post that is I2, with a label "Dog name:" in H2. Keep the label. A sitter or relative who opens the sheet will know at once what to type, and you will know where to look when you come back to it months later.
Type a name exactly as it appears in column A, such as Juniper. This cell is the lookup value, and it is the only thing a person needs to change to see a different dog. You can keep the same formulas in place and simply type a new name to flip from one dog to the next.
The Microsoft example on the XLOOKUP page uses the same three parts you will use. It includes the lookup_value in cell F2, the lookup_array in range B2:B11, and the return_array in range D2:D11. Microsoft, XLOOKUP function Your sheet will use different cells, but the roles are the same: one value to look for, one column to search, and one column to return the answer from.
Typos are a common reason a lookup fails, so take a moment to make the name cell hard to get wrong. Some spreadsheet programs let you limit a cell to a list of allowed values, so that only names from the table can be entered. If yours does, apply that setting to I2. If it does not, type the name slowly, or copy it from the sheet and paste it into I2. Either way, a quick glance at the result will tell you whether the name matched.
Step 3: Write the XLOOKUP formula
Put the label "Breed:" in H3 and the formula in I3. Type this:
=XLOOKUP(I2,$A:$A,$B:$B)
Here is what each piece does:
- I2 is the lookup value. It is the name you typed. XLOOKUP looks for this text.
- $A:$A is the lookup array. It is the whole names column. XLOOKUP searches this column for the name, and the header in row 1 will not match a dog's name.
- $B:$B is the return array. It is the whole breed column. When XLOOKUP finds a match, it returns the entry in the same row from this column.
The two ranges must cover the same rows. Because both use whole columns, they always line up. If you ever replace a whole-column reference with a fixed range, make sure both ranges start and end on the same rows, or the answer may not line up with the names, and you may see a result that looks right but belongs to a different dog.
The dollar signs are intended to keep the ranges in place when copying. If you copy the formula to another cell, check that the ranges stay on the table instead of shifting down or across, which would point the formula at the wrong data. Without the dollar signs, a copied formula can quietly change which cells it reads.
Now test it. Type Biscuit into I2, and the breed should appear in I3. Then try Otis, then Juniper, then Maple. Testing each dog shows whether the formula reads every row and not just the first few. If one dog gives an answer that is clearly wrong, check that row first. A common cause is a name with a stray space or a spelling that differs from the table.
To pull a different detail, change only the return array. For the vet, use $D:$D. For the next vaccine, use $E:$E. The lookup array and the name cell stay the same. Give each output its own label and cell, so the sheet reads like a card: a name at the top, then breed, vet, and vaccine date in order.
XLOOKUP also has optional arguments that change how it matches. The Microsoft page describes a search that starts at the first item, and a wildcard match, where , ?, and ~ have special meaning. Microsoft, XLOOKUP function A wildcard can help when you remember only part of a name. With that setting, a pattern such as Bis could match Biscuit. Check the result to be sure it found the dog you meant, because a partial name can match more than you expect.
The page also describes a binary search, which relies on the lookup array being sorted in ascending order. Microsoft, XLOOKUP function A household sheet rarely needs it. If you do choose it, sort the whole table by the Name column in ascending order, keeping every dog's details together, or the search may not find the right row. For a list of a few dogs, the search that starts at the first item is simpler and easier to check.
Illustrative example: check a breed
An illustrative list has 10 dogs, each in its own row. Type a listed name into I2. Compare the breed returned in I3 with the breed beside that name in the table. Change the name and repeat.
Step 4: Return more than one detail
Microsoft notes that, unlike VLOOKUP, XLOOKUP can return an array with multiple items, so a single formula can return more than one column. Microsoft, XLOOKUP function For a dog record, that means you can pull the whole row at once instead of building a separate formula for each detail.
To try it, leave a few empty rows below your card. Type this in an empty cell outside columns A to G, such as I6 below the card; column A would include the formula itself in $A:$A and create a circular reference:
=XLOOKUP(I2,$A:$A,$B:$G)
The details from breed through notes should appear across the cells to the right, in the same order as the column headings. Because the output fills several cells, make sure the cells to the right are empty. If cells to the right are not empty, the formula may not display the full row, so check the result after typing it. If the sheet will be opened in an older version of Excel, test this version there first, for the same reason covered at the start of this post.
A name that is not in the list gives the formula nothing to return. Check its spelling against column A before trying again.
A quick checklist before you share the sheet
Run through these checks once before you hand the file to anyone else:
- Each dog has one row, and each name is spelled the same way everywhere it appears.
- The name cell holds the exact name, with no extra spaces.
- The lookup and return ranges cover the same rows, and you have tested a dog added at the bottom.
- You have tested the formula with at least two dogs from the list.
- The formula works in the oldest version of the spreadsheet program that anyone in the household uses.
Once this sheet works, the same pattern fits other records. A list of walk notes, a medication log, or a set of vet contacts can each have a name column, one lookup cell, and a formula that searches the names. This layout needs one row for each name; a medication log or walk-notes list with several rows for each dog needs a different layout because XLOOKUP returns only the first match. What changes is the set of columns you return. Start with the dog card, get the test right, and the rest of the household records will follow the same method.
It is also worth a short review every few months. Check that the names still match, that the ranges still cover every dog, and that the vaccine dates are current. A lookup only shows what is in the table, so the sheet is only as useful as the care you put into keeping it up to date. For a related routine, see daily dog care reminders.
Today, enter a dog's name in I2 and compare the returned breed with that dog's row before sharing the sheet.
Check your lookup
Can the formula return several details?
Yes, the $B:$G return range is intended to return breed through notes together.
What should I check when a name does not match?
Check the spelling and extra spaces against the names column.
Can I use another spreadsheet program?
Check that program's help for its lookup function and formula wording.