Help with data validation lists, vlookup and making a "calculator"

GAFFiO

New Member
Joined
Nov 15, 2021
Messages
2
Platform
  1. Windows
Hello all

I’m a bit of a novice with excel but I’m trying to teach myself to make a simple calculator for carbohydrates in different food ingredients. For this I have made a formula to take the ingredient type and the unit of measurement and use VLOOKUP to take the relevant carb count from the table/cell range.

The end result is to be able to list all the ingredients in a recipe to give me a total carb count (after I research and input all the ingredients/counts etc)

On the Testing sheet I have a row of data which includes:
  • An Amount cell for the user to enter the value/amount of the ingredient.
  • A Data Validation dropdown list for an ingredient (column C)
  • A Data Validation dropdown list for unit measurement (column D)
  • Column E combines the ingredient/measurement (this is the only way I could work out how to make this work, I plan to hide this column)
  • Column F just displays the carbs per ingredient/measurement (I plan to hide this too)
  • Column G uses a simple =Sum to calculate the data from column B and F to show the total carbs.
The Vegetable sheet contains a list of the ingredient, the combined ingredient/measurement, and the amount carbs per.

The Units sheet simply has the list of measurements, for the data validation lists.


As you will see I have it working well, however the problem I have is in the dropdown list on column C it has each onion type listed 5 times, as per my data on the vegetables sheet. I understand it is doing this because of my data validation is taking all the cells in the column A on the vegetables sheet.

Is there a way to use a formula or something within the “source” box in data validation dialog window to ignore duplicates? All googling I have done simply shows you how to remove the duplicates within the cell range, however if I do this it will destroy my other formulas.

Is there a better/easier method for what I’m trying to achieve?

Any tips on other features/formulas/comments I could study to make my “calculator”?

I hope this all makes sense,

Thank you

P.S Ignore all the values etc its just in testing stage ATM. :)
P.S.S I hope the "minisheets" work, my first time doing so.

My Carb Calculator V1.1.1freshtest.xlsx
ABCDEFG
1AmountTypeUnitHide ThisCarbs per/HideHow many carbs
2Test013Onion, RedtbspOnion, Red, tbsp26
3Test021Onion, RedtbspOnion, Red, tbsp22
4Test032Onion, BrowncupOnion, Brown, cup2040
5Test051Onion, SpringtspOnion, Spring, tsp11
6Total:49
Testing
Cell Formulas
RangeFormula
E2:E5E2=C2&", "&D2
F2:F5F2=VLOOKUP(E2,Vegetables!B2:C21,2,FALSE)
G2:G5G2=SUM(B2*F2)
G6G6=SUM(G2:G5)
Cells with Data Validation
CellAllowCriteria
C2:C5List=Vegetables!$A$2:$A$21
D2:D5List=Units!$A$2:$A$6


My Carb Calculator V1.1.1freshtest.xlsx
ABC
1OnionsComb/HideCarbs
2Onion, BrownOnion, Brown, grams10
3Onion, BrownOnion, Brown, ml5
4Onion, BrownOnion, Brown, tbsp2
5Onion, BrownOnion, Brown, tsp1
6Onion, BrownOnion, Brown, cup20
7Onion, RedOnion, Red, grams10
8Onion, RedOnion, Red, ml5
9Onion, RedOnion, Red, tbsp2
10Onion, RedOnion, Red, tsp1
11Onion, RedOnion, Red, cup20
12Onion, WhiteOnion, White, grams10
13Onion, WhiteOnion, White, ml5
14Onion, WhiteOnion, White, tbsp2
15Onion, WhiteOnion, White, tsp1
16Onion, WhiteOnion, White, cup20
17Onion, SpringOnion, Spring, grams10
18Onion, SpringOnion, Spring, ml5
19Onion, SpringOnion, Spring, tbsp2
20Onion, SpringOnion, Spring, tsp1
21Onion, SpringOnion, Spring, cup20
Vegetables
Cell Formulas
RangeFormula
B2:B6B2=A2&", "&Units!$A2
B7:B11B7=A7&", "&Units!$A2
B12:B16B12=A12&", "&Units!$A2
B17:B21B17=A17&", "&Units!$A2


My Carb Calculator V1.1.1freshtest.xlsx
A
1Units
2grams
3ml
4tbsp
5tsp
6cup
Units
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Welcome to Mr. Excel,

What version of Excel do you run? 365?

For one: you don't need the SUM in G2. You can change G2 from SUM(B2*F2) to simply: = B2*F2

You could make F2 a VLOOKUP without E2 by using a concatenation within the lookup: =VLOOKUP(C2&", "&D2, etc.)

If you're using 365, there is a "spill" feature that would allow you to put: ="Onion, Brown, "&Units!A2:A6 into A2 of the vegetables able (etc.)

Just a few quick thoughts and observations.
 
Upvote 0
Hi kweaver, thanks for your response.

What version of Excel do you run? 365?
I do run 365, sorry I should have mentioned that.

For one: you don't need the SUM in G2. You can change G2 from SUM(B2*F2) to simply: = B2*F2
You could make F2 a VLOOKUP without E2 by using a concatenation within the lookup: =VLOOKUP(C2&", "&D2, etc.)
I made both of these adjustments! :)

If you're using 365, there is a "spill" feature that would allow you to put: ="Onion, Brown, "&Units!A2:A6 into A2 of the vegetables able (etc.)

I have briefly looked into this, and have found a video to explain it. I will watch this later and work it out :) Will this be a solution to multiples of the same name on the C2:C5 pull down lists?

I think I know how to remove the E column on Testing! by referring F2:F5 cells to the Vegetables! cells instead. I will work on this later too.

Thanks for your help! :)

My Carb Calculator V1.2.MrExcel.xlsx
ABCDEF
1AmountTypeUnitCarbs per/HideHow many carbs
2Test011Onion, Browngrams1010
3Test021Onion, Brownml55
4Test031Onion, Browntbsp22
5Test041Onion, Browntsp11
6Total:18
Testing
Cell Formulas
RangeFormula
E2:E5E2=VLOOKUP(C2&", "&D2,Vegetables!B2:C21,2,FALSE)
F2F2=B2*E2
F3:F5F3=SUM(B3*E3)
F6F6=SUM(F2:F5)
Cells with Data Validation
CellAllowCriteria
C2:C5List=Vegetables!$A$2:$A$21
D2:D5List=Units!$A$2:$A$6
 
Upvote 0
I do run 365, sorry I should have mentioned that.
In that case, I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0

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