Lookup

Stclements1

Board Regular
Joined
Sep 15, 2018
Messages
150
Office Version
  1. 365
Platform
  1. Windows
I have a list of headings of which each has various subheadings, as per the example below. On my spreadsheet in Cell B3, I want to put the subheading i.e "Supplements" and I want Cell F3 to know that comes under ANIMALS (VETERINARY) and display ANIMALS (VETERINARY), but I'm not sure whether I would use LOOKUP for this?
ANIMALS (VETERINARY)
Medication
Supplements
Annual Vaccinations
Animal Transportation
Animal Hospitalisation
Vet Consultation
Vet Transportation
Animal Insurance
Parasite Treatment
ANIMALS (FOOD)
Chicken
Game (Alloa meat)
Game (H W Gutter)
Meat Handling Wear
Domestic Animal Feed
Dog Feed
Meat Preperation Equipment
Cleaning Materials
ANIMALS (HABITAT)
Teff
Hay
Enrichment
Dens & Platforms
Fly Catchers
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Based on the assumption that the headers to return are the upper case ones.
Book1
ABF
1ANIMALS (VETERINARY)
2Medication
3SupplementsSupplementsANIMALS (VETERINARY)
4Annual VaccinationshayANIMALS (HABITAT)
5Animal Transportation
6Animal Hospitalisation
7Vet Consultation
8Vet Transportation
9Animal Insurance
10Parasite Treatment
11ANIMALS (FOOD)
12Chicken
13Game (Alloa meat)
14Game (H W Gutter)
15Meat Handling Wear
16Domestic Animal Feed
17Dog Feed
18Meat Preperation Equipment
19Cleaning Materials
20ANIMALS (HABITAT)
21Teff
22Hay
23Enrichment
24Dens & Platforms
25Fly Catchers
Sheet1
Cell Formulas
RangeFormula
F3:F4F3=LET(r,MATCH(B3,$A$1:$A$25,0),rng,$A$1:INDEX($A$1:$A$25,r),LOOKUP(2,1/(EXACT(rng,UPPER(rng))),rng))
 
Upvote 0
Your data look more like a MS Word kind of data.

Ideally in Excel it is recommended to put Headers and Subheader in separate columns - This way you get more control over your data and use it in different ways.

The way Jason explains above can be a way to do but not an ideal situation to control your data.
 
Upvote 0
LET(r,MATCH(B3,$A$1:$A$25,0),rng,$A$1:INDEX($A$1:$A$25,r),LOOKUP(2,1/(EXACT(rng,UPPER(rng))),rng))
Many thanks for getting back to me, unfortunately, I get an error message each time I try to use the formula that says "The first argument of LET must be a valid name" am I entering the data incorrectly?
 
Upvote 0
Have you tried to edit the formula in any way? There is no reason for that message to come up if you're entering it exactly as posted.

The first definition isn't strictly necessary and can be moved as shown below but the formula still works with it in there.
Excel Formula:
=LET(rng,$A$1:INDEX($A$1:$A$25,MATCH(B3,$A$1:$A$25,0)),LOOKUP(2,1/(EXACT(rng,UPPER(rng))),rng))
 
Upvote 0
Once again many thanks for coming back to me I do appreciate the help. I have copied and pasted the formula into my spreadsheet and also typed it in and both times I get an error message, now it is saying "You can't include a parameter to a LET function after defining its calculation" I haven't altered anything from what you sent.
 
Upvote 0
Could you confirm that you are using Office 365 (not an alternative like google sheets, or another version of Excel).

Also, is your device set up in a language other than English, or with settings where a comma is used as a decimal separator instead of a dot / period?

I've checked both formulas in case there was a problem when I copied them to the forum and both are perfectly fine so there is something else causing the problem, it's just a case of finding what that is.
 
Upvote 0
As well as Jason's questions, are you using A1 or R1C1 notation?
 
Upvote 0
Thank you for your continued help, I am using office 365 and I am certain that my version of Excel is the most up-to-date one. I use ; as a seperator. I have copied and pasted the formula into my worksheet and as per the previous messages, I get the two error messages. I have also typed it directly into the worksheet and again I get the error messages. I believe that I am doing everything as I should so I really don't know why it is returning these messages.
 
Upvote 0
As well as Jason's questions, are you using A1 or R1C1 notation?
I am not sure what A1 or R1C1 notation is, all I can say is that I am using an excel package that is no different from any earlier versions in the way that I input data.
 
Upvote 0

Forum statistics

Threads
1,215,694
Messages
6,126,251
Members
449,305
Latest member
Dalyb2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top