Link cells

pboltonchina

Well-known Member
Joined
Apr 24, 2008
Messages
1,117
Hi Everyone,
Been a long time since I did any of this, but here goes.
I have a sheet with a list of meals, at the side of the meal list is a column with the Carbs value. So Sheet "Meals List" has the data for the drop down, sheet "Meals 1" has the drop down itself and sheet "Record" is where I want the copied value pasting. When I select from the drop down list I want to put the carbs value for that item in a cell on the Records sheet. I hope this makes sense to someone who could help me with this.

As always, many thanks in advance for any help offered.
Regards
Paul
 
not sure who you are responding to
maybe , as posted by CUBIST using filter and lookup
=XLOOKUP(FILTER('Meals 1'!$B$2:$D$1000,'Meals 1'!$A$2:$A$1000=record!B2),'Meals list'!$A$1:$A$1000,'Meals list'!$B$1:$B$1000)
and for meals 2
=XLOOKUP(FILTER('Meals 2'!$B$2:$D$1000,'Meals 2'!$A$2:$A$1000=record!B2),'Meals list'!$A$1:$A$1000,'Meals list'!$B$1:$B$1000)

may need to extend the ranges a lot further

only on dropbox for a few days

June Carb Counter - ETAF.xlsx
ABCDEFGHIJK
1DateBreakfastLunchDinnerDessertSupperSnacksTotalAllowanceDifference
23-Jun41.01234.0#N/A#N/A#N/A170.0170.0
34-Jun62.3#N/A#N/A4567.0#N/A170.0170.0
45-Jun41.0#N/A#N/A#N/A170.0170.0
56-Jun41.082.0 #N/A#N/A170.0170.0
67-Jun41.0#N/A#N/A4567.0#N/A170.0170.0
78-Jun41.0 170.0170.0
89-Jun  170.0170.0
910-Jun  170.0170.0
1011-Jun  170.0170.0
1112-Jun  170.0170.0
1213-Jun  170.0170.0
1314-Jun  170.0170.0
1415-Jun  170.0170.0
1516-Jun  170.0170.0
1617-Jun  170.0170.0
1718-Jun  170.0170.0
1819-Jun  170.0170.0
1920-Jun  170.0170.0
2021-Jun  170.0170.0
2122-Jun  170.0170.0
2223-Jun  170.0170.0
2324-Jun  170.0170.0
2425-Jun  170.0170.0
2526-Jun  170.0170.0
2627-Jun  170.0170.0
2728-Jun  170.0170.0
2829-Jun  170.0170.0
2930-Jun  170.0170.0
30
record
Cell Formulas
RangeFormula
C2:E29C2=XLOOKUP(FILTER('Meals 1'!$B$2:$D$1000,'Meals 1'!$A$2:$A$1000=record!B2),'Meals list'!$A$1:$A$1000,'Meals list'!$B$1:$B$1000)
F2:H29F2=XLOOKUP(FILTER('Meals 2'!$B$2:$D$1000,'Meals 2'!$A$2:$A$1000=record!B2),'Meals list'!$A$1:$A$1000,'Meals list'!$B$1:$B$1000)
K2:K29K2=SUM(J2-I2)
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K2:K29Cell Value>0textNO
K2:K29Cell Value<0textNO
K2:K29Cell Value>43.4textNO



June Carb Counter - ETAF.xlsx
ABCD
1DateBreakfastLunchDinner
23-Jun40g Malt WheatsHam SaladEgg On Beans On Toast
34-Jun60g Malt WheatsChicken SoupCheese Omelette + Sausage + Peppers
45-Jun40g Malt WheatsTurkey Sandwich And CrispsScampi, Fried Potatoes & Peas
56-Jun40g Malt WheatsChip Butty
67-Jun40g Malt WheatsFried Eggs On ToastChicken Stir Fry With Noodles
78-Jun40g Malt Wheats
89-Jun
910-Jun
1011-Jun
Meals 1
Cells with Data Validation
CellAllowCriteria
B8:B10List='Meals list'!$A$1:$A$3
C7:C29List='Meals list'!$A$5:$A$15
D7:D29List='Meals list'!$A$17:$A$32



June Carb Counter - ETAF.xlsx
AB
160g Malt wheats62.3
240g Malt Wheats41
32 Weetabix42.6
4
5Chicken & Mushroom18.6
6Tomato & Basil26.2
7Beef & veg Big Soup15
8Salad with H & M Dressing8
9Salad with Caesar Dressing20
10Salad with Vinaigrette Dressing11.6
11Beans On Toast34
12Egg On Toast18.5
13Chip Butty82
142 Crumpets40
15Sandwich (any)37
16
17Risotto60
18Fry Up0
19Pork Schnitzel82
20Bacon Wrapped Chicken42
21Omelette3
22Spag Bol78
23Chicken Burger & Onion Rings23
24Chicken Korma & Rice62
25Fish & Chips76
26Fish , Chips & Mushy Peas91
27Shepherds Pie20
28Gnocchi65
29Stir Fry20
30Pie & Peas55
31Salmon52
32Steak42
33
34Jelly18
35Jelly & Raspberries23
36Jelly & Strawberries24
37Lemon Yoghurt9
38Mango, Papaya & Passion Fruit19.1
39Ham Salad1234
40Peach, Passion Fruit & Mango Yoghurt4567
Meals list
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi etaf,
Seems to be working fine, is there any way of getting rid of al the #N/A's populating cells. I don't understand the formula so I don't know why some cells are clear and others showing #N/A?
Cheers
Paul
 
Upvote 0
N/A means an error and could not find the lookup value
you can use an IFERROR ( ) if using the index/match version
OR xlookup has an error condition

=XLOOKUP(FILTER('Meals 1'!$B$2:$D$1000,'Meals 1'!$A$2:$A$1000=record!B2),'Meals list'!$A$1:$A$1000,'Meals list'!$B$1:$B$1000,"")
=XLOOKUP(FILTER('Meals 2'!$B$2:$D$1000,'Meals 2'!$A$2:$A$1000=record!B2),'Meals list'!$A$1:$A$1000,'Meals list'!$B$1:$B$1000,"")



for this version add an IFERROR to this
=INDEX('Meals list'!$B$1:$B$1000,MATCH(INDEX('Meals 1'!$B$2:$D$100,MATCH(Record!$B2,'Meals 1'!$A$2:$A$100,0),MATCH(Record!C$1,'Meals 1'!$B$1:$D$1,0)),'Meals list'!$A$1:$A$1000,0))

=iferror(INDEX('Meals list'!$B$1:$B$1000,MATCH(INDEX('Meals 1'!$B$2:$D$100,MATCH(Record!$B2,'Meals 1'!$A$2:$A$100,0),MATCH(Record!C$1,'Meals 1'!$B$1:$D$1,0)),'Meals list'!$A$1:$A$1000,0)),"")

the filter version
FILTER('Meals 1'!$B$2:$D$1000,'Meals 1'!$A$2:$A$1000=record!B2),
returns ALL the Meals which match the data - as meals 1 headers are in the same order as the record then they match
and so that will return - the meals for that date for the header array

and then xlookup uses the value found in the meals 1 & meals 2 sheets and then returns the value in the list column B which matches those meals in column A
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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