Max,
See my post... you can do it without changing the data. Sometimes your data
has to be a certain way for some other function. It definitely appeared to
me that the data was set up to print as a brochure. My formula works with
the data as is so there is no additonal setup time with the data.
Thanks,
ryanb.
ok... here it is... if you want an attachment of a workbook where it works,
email me and I will send it to you
on the MENU sheet
Assume row 1 is the header
A2= recipe #
Name
B2=IF(ISNA(MATCH($A2,'Sheet2 - Nutrional information'!$B$1:$B$8,0)),"NO
MATCH",INDEX('Sheet2 - Nutrional information'!$A$1:$J$8,MATCH($A2,'Sheet2 -
Nutrional information'!$B$1:$B$8,0),1))
Portion
C2=IF(ISNA(MATCH($A2,'Sheet2 - Nutrional information'!$B$1:$B$8,0)),"NO
MATCH",INDEX('Sheet2 - Nutrional information'!$A$1:$J$8,MATCH($A2,'Sheet2 -
Nutrional information'!$B$1:$B$8,0),3))
Calories
D2=IF(ISNA(MATCH($A2,'Sheet2 - Nutrional information'!$B$1:$B$8,0)),"NO
MATCH",INDEX('Sheet2 - Nutrional information'!$A$1:$J$8,MATCH($A2,'Sheet2 -
Nutrional information'!$B$1:$B$8,0),4))
Protein
E2=IF(ISNA(MATCH($A2,'Sheet2 - Nutrional information'!$B$1:$B$8,0)),"NO
MATCH",INDEX('Sheet2 - Nutrional information'!$A$1:$J$8,MATCH($A2,'Sheet2 -
Nutrional information'!$B$1:$B$8,0)+1,4))
Carbo
F2=IF(ISNA(MATCH($A2,'Sheet2 - Nutrional information'!$B$1:$B$8,0)),"NO
MATCH",INDEX('Sheet2 - Nutrional information'!$A$1:$J$8,MATCH($A2,'Sheet2 -
Nutrional information'!$B$1:$B$8,0),5))
D Fib
G2=IF(ISNA(MATCH($A2,'Sheet2 - Nutrional information'!$B$1:$B$8,0)),"NO
MATCH",INDEX('Sheet2 - Nutrional information'!$A$1:$J$8,MATCH($A2,'Sheet2 -
Nutrional information'!$B$1:$B$8,0)+1,5))
And so on and so on every other row ends the match function in +1
HTH,
ryanb.
ryanb. said:
just copy and paste 5 rows of data from sheet 2 into your message
someone will show you how to do it without the array. Arrays are nice, but
they are extremely "touchy". It will be very easy.
Thanks,
ryanb.
Max said:
The Nutritional Info sheet needs to be redesigned so that the data
for each recipe # is arranged in a single row, instead of the curent
way with "vertical-merged cells" and "double-stacking of data",
viz. to a structure like that indicated below:
In Sheet named: Nutritional Info
(Sample of redesigned data in A1:W3)
-------------------------------------------------------------------------- --
----------
Recipe
Name..............Recipe#...Portion...Calories...Carbo......Fat.......etc
Asian Bay Shakers.....16664...4 pieces....238.......21.1 gm...14.6 gm....etc
Baba Ghanoush............4441..........1 oz.....32.........3.1 gm.....2.2
gm....etc
With the above done, you could then in the Sheet named: Menu,
easily create and retrieve info based on Recipe#s entered in col A,
row 2 downwards using say, OFFSET & MATCH
Assuming the cols to the right of col A (Recipe#) in "Menu" sheet are
in the *same order* as that in "Nutritional Info" sheet, i.e.:
Recipe#...Portion...Calories...Carbo......Fat.........etc
Put in B2 (Under "Portion"):
=IF(ISNA(OFFSET('Nutritional Info'!$B$2,MATCH($A2,'Nutritional
Info'!$B:$B,0)-2,COLUMN()-1,1,1)),"-",OFFSET('Nutritional
Info'!$B$2,MATCH($A2,'Nutritional Info'!$B:$B,0)-2,COLUMN()-1,1,1))
Copy B2 across B2:V2 (where col V = rightmost col),
then copy down as many rows as you have data in col A
Note: The IF(ISNA(OFFSET(..),"-",OFFSET(..)) is an error handling construct
to ensure that invalid recipe#(s) will return "-" in cols B - V
hth
Max