So I'm trying to create a food calculator that automatically places the values for Fats, Carbs, and Proteins based on the name of the food. Essentially, if column A = column J, then automatically pull the amount so that the corresponding values of J get pulled over also; so that column B = column K, col C = col L and col D = col M. I want to get it so that I just have to type the name of the food item, and it fills in the rest based on the database values on the right.
I have attached a picture of the sheet I'm working on to get a clearer idea of what I'm talking about. It seems like there should be some formula to do this, but I can't seem to get it done. All help is appreciated, and thanks ahead of time!
Last edited by Wiseguy158; 08-24-2011 at 11:54 PM. Reason: Problem Solved
Have a look at VLOOKUP in Excel help files.
e.g.
=IF($A2="","",VLOOKUP(A2,$J:$O,2,FALSE))
This first looks to see if there is anything in A2, if not it returns a blank... then it looks for value of A2 in column J and returns result from column 2 of that table.
Copy formula down.
For next column sub the 2 for a 3, and copy down, etc...
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks