Hello everyone,
I'm struggling with a formula. In the table below is what I actually have in my worksheet. In the first column, the column to the extreme left (column A) there are various fruits categorized according to whether they are vegetables, fruits or nuts. In the table1, there are the same fruits but are not categorized. Further, in the table1 you can see how many units of each fruit were received during various months. Where there are no values it means that no fruit was received.
What I need to accomplish in the table2 is to have number of all the vegetables, fruits and nuts for each month.
For example, in the table2, in the vegetable row for January, there should be number 8 because only 8 units of vegetables were received during the month of January (2 carrots and 6 radishes).
Another example, in the nuts row for August, there should be number 18 because 18 units of nuts were received during the month of August (7 peanuts, 7 hazelnuts and 4 walnuts).
The important thing is that in the following months, like October, November and December I may add other vegetables, fruits and/or nuts to the column A and therefore also to the table1, thus augmenting the table1 (I would add additional rows).
I think that the formula, which goes to the table2 in order to give me the results I quoted in the examples, should first determine whether the fruit in the table1 is vegetable, fruits or nut. I tried to do that using SUMIF formula but without any success. Maybe this task require an advanced use of array formulas with which I am not very familiar.
Could you please help me with this problem? Please, bear in mind that I cannot change the structure of the tables nor of the column A.
Thank you very much in advance!
[TABLE="class: grid, width: 712"]
<tbody>[TR]
[TD]vegetable[/TD]
[TD][/TD]
[TD]table1[/TD]
[TD]January[/TD]
[TD]February[/TD]
[TD]March[/TD]
[TD]April[/TD]
[TD]June[/TD]
[TD]July[/TD]
[TD]August[/TD]
[TD]September[/TD]
[/TR]
[TR]
[TD]carrot[/TD]
[TD][/TD]
[TD]peanut[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD]radish[/TD]
[TD][/TD]
[TD]apple[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD]turnip[/TD]
[TD][/TD]
[TD]banana[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]7[/TD]
[/TR]
[TR]
[TD]cucumber[/TD]
[TD][/TD]
[TD]carrot[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD]cabbage[/TD]
[TD][/TD]
[TD]radish[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]fruits[/TD]
[TD][/TD]
[TD]grape[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]apple[/TD]
[TD][/TD]
[TD]hazelnut[/TD]
[TD][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]9[/TD]
[/TR]
[TR]
[TD]pear[/TD]
[TD][/TD]
[TD]pear[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]9[/TD]
[/TR]
[TR]
[TD]banana[/TD]
[TD][/TD]
[TD]raspberry[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD][/TD]
[TD]walnut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD]raspberry[/TD]
[TD][/TD]
[TD]cucumber[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]nuts[/TD]
[TD][/TD]
[TD]cabbage[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD]hazelnut[/TD]
[TD][/TD]
[TD]turnip[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]walnut[/TD]
[TD][/TD]
[TD]coconut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD]peanut[/TD]
[TD][/TD]
[TD]pine nut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]coconut[/TD]
[TD][/TD]
[TD]total[/TD]
[TD="align: center"]36[/TD]
[TD="align: center"]30[/TD]
[TD="align: center"]52[/TD]
[TD="align: center"]47[/TD]
[TD="align: center"]45[/TD]
[TD="align: center"]52[/TD]
[TD="align: center"]58[/TD]
[TD="align: center"]52[/TD]
[/TR]
[TR]
[TD]pine nut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]table2[/TD]
[TD]January[/TD]
[TD]February[/TD]
[TD]March[/TD]
[TD]April[/TD]
[TD]June[/TD]
[TD]July[/TD]
[TD]August[/TD]
[TD]September[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]vegetable[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]fruits[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]nuts[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I'm struggling with a formula. In the table below is what I actually have in my worksheet. In the first column, the column to the extreme left (column A) there are various fruits categorized according to whether they are vegetables, fruits or nuts. In the table1, there are the same fruits but are not categorized. Further, in the table1 you can see how many units of each fruit were received during various months. Where there are no values it means that no fruit was received.
What I need to accomplish in the table2 is to have number of all the vegetables, fruits and nuts for each month.
For example, in the table2, in the vegetable row for January, there should be number 8 because only 8 units of vegetables were received during the month of January (2 carrots and 6 radishes).
Another example, in the nuts row for August, there should be number 18 because 18 units of nuts were received during the month of August (7 peanuts, 7 hazelnuts and 4 walnuts).
The important thing is that in the following months, like October, November and December I may add other vegetables, fruits and/or nuts to the column A and therefore also to the table1, thus augmenting the table1 (I would add additional rows).
I think that the formula, which goes to the table2 in order to give me the results I quoted in the examples, should first determine whether the fruit in the table1 is vegetable, fruits or nut. I tried to do that using SUMIF formula but without any success. Maybe this task require an advanced use of array formulas with which I am not very familiar.
Could you please help me with this problem? Please, bear in mind that I cannot change the structure of the tables nor of the column A.
Thank you very much in advance!
[TABLE="class: grid, width: 712"]
<tbody>[TR]
[TD]vegetable[/TD]
[TD][/TD]
[TD]table1[/TD]
[TD]January[/TD]
[TD]February[/TD]
[TD]March[/TD]
[TD]April[/TD]
[TD]June[/TD]
[TD]July[/TD]
[TD]August[/TD]
[TD]September[/TD]
[/TR]
[TR]
[TD]carrot[/TD]
[TD][/TD]
[TD]peanut[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD]radish[/TD]
[TD][/TD]
[TD]apple[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD]turnip[/TD]
[TD][/TD]
[TD]banana[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]7[/TD]
[/TR]
[TR]
[TD]cucumber[/TD]
[TD][/TD]
[TD]carrot[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD]cabbage[/TD]
[TD][/TD]
[TD]radish[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]fruits[/TD]
[TD][/TD]
[TD]grape[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]apple[/TD]
[TD][/TD]
[TD]hazelnut[/TD]
[TD][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]9[/TD]
[/TR]
[TR]
[TD]pear[/TD]
[TD][/TD]
[TD]pear[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]9[/TD]
[/TR]
[TR]
[TD]banana[/TD]
[TD][/TD]
[TD]raspberry[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD][/TD]
[TD]walnut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD]raspberry[/TD]
[TD][/TD]
[TD]cucumber[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]nuts[/TD]
[TD][/TD]
[TD]cabbage[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD]hazelnut[/TD]
[TD][/TD]
[TD]turnip[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]walnut[/TD]
[TD][/TD]
[TD]coconut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD]peanut[/TD]
[TD][/TD]
[TD]pine nut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]coconut[/TD]
[TD][/TD]
[TD]total[/TD]
[TD="align: center"]36[/TD]
[TD="align: center"]30[/TD]
[TD="align: center"]52[/TD]
[TD="align: center"]47[/TD]
[TD="align: center"]45[/TD]
[TD="align: center"]52[/TD]
[TD="align: center"]58[/TD]
[TD="align: center"]52[/TD]
[/TR]
[TR]
[TD]pine nut[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]table2[/TD]
[TD]January[/TD]
[TD]February[/TD]
[TD]March[/TD]
[TD]April[/TD]
[TD]June[/TD]
[TD]July[/TD]
[TD]August[/TD]
[TD]September[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]vegetable[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]fruits[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]nuts[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]