Data Validation with named range?

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
1,402
Office Version
  1. 2019
  2. 2007
Platform
  1. Windows
Hi all,
I have created an excel workbook, to keep track of the carbs I eat, as I have just been diagnosed with Type 2 diabetes. This is called Foods. I created a dynamic range and named it Item as the foods will grow as I find others that are low carb.
So I have a sheet for the foods I eat, with their carbs, sugar and net carbs plaus the date.
On another sheet I have the foods I actually eat per day, picking from the list on the Foods sheet.

However I have discovered that if I use the named range, then entering an invalid entry just gets accepted. I just changed the validation to Foods!$A2:$A1000 and an invalid entry gets rejected with the normal error message.

This is the first time I have used a dynamic range for data validation. Is there a way to get the same error validation as a hardcoded range at all please?

Diabetes.xlsx
ABCDEF
1DateMealItemFactorCarbsSugar
214/04/2023LunchTortilla, DK114.600.80
314/04/2023LunchLettuce0.260.360.36
414/04/2023LunchCelery,Fruit & Nut Sald0.918.927.55
514/04/2023LunchSouthern Fried Chicken, Tesco445.201.20
614/04/2023DinnerSouthern Fried Chicken, Tesco445.201.20
714/04/2023SnacksIce cream Carte Dor Mint 100g1.336.4031.20
815/04/2023BreakfastBacon 20.200.00
915/04/2023BreakfastPork Sausage21.601.20
1015/04/2023BreakfastEgg21.201.20
1115/04/2023DinnerLettuce0.390.550.55
1215/04/2023DinnerSpring Onions 0.141.010.45
1315/04/2023DinnerCucumber0.281.060.48
1415/04/2023DinnerColeslaw Aldi0.473.152.54
1515/04/2023SnacksKit Kat Easter Egg0.654.7254.24
1615/04/2023DrinkAbbot Ale690.0090.00
1716/04/2023LunchTortilla, DK114.600.80
1816/04/2023LunchLettuce0.290.410.41
1916/04/2023LunchChicken & Bacon Salad1.063.820.53
2016/04/2023DinnerPotatoes2.741.589.45
2116/04/2023DinnerMushrooms0.50.200.10
2216/04/2023DrinkRose Wine (Grove Manor) 100ml1545.0045.00
2316/04/2023SnacksChocolate Chip (1)17.003.60
2417/04/2023BreakfastBluberries0.423.823.82
2517/04/2023BreakfastYoghurt Aldi1.335.724.52
2617/04/2023SnacksChocolate Chip (1)321.0010.80
270.000.00
Daily
Cell Formulas
RangeFormula
E2:E27E2=IF($D2="",0,VLOOKUP($C2,Foods,2,FALSE)*$D2)
F2:F27F2=IF($D2="",0,VLOOKUP($C2,Foods,3,FALSE)*$D2)
Cells with Data Validation
CellAllowCriteria
B:BList=Meals
C:CList=Item




Named Ranges.PNG
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Make sure you uncheck the 'Ignore blank' option in the DV settings.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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