Forum Discussion

porridge's avatar
porridge
Copper Contributor
Jul 31, 2022
Solved

excel table

Hello everyone. I am new here. I am currently learning excel and improving my skills. 

 

I am currently working on a small college project, and I searched the internet but didn't get the answer I wanted. I tried many things but the end result wasn't successful.

 

I would like to mention the problem, and I would appreciate it if you could help me/ point me in the right direction.

 

I am working on a food project. There are many recipes (almost 70). My table consists of the SKU product code, recipe description, and the allergens present in them (3 allergens). I have made the table like this..vertically and horizontally in which there is the SKU and description and now in the middle, I want to have only those allergens that aren't common with the other recipe if I am comparing 2 recipes. 

ex: if recipe 1 has 3 allergens (milk, mustard, and eggs) and the 2nd recipe has only eggs in it, so when I am doing a change of recipes in cooking, I want the cells to show the only allergens which aren't common. ie milk and mustard. 

 

ps: I tried vlookup, if, ifs, but I wasn't able to solve it. 

 

I believe that I came to the right place to find the solution, I look forward to your responses 🙂

 

 

 

 

 

  • Hiporridge

    I thought you wanted to do the assignment themselves as a school project. How many points will I get from the teacher? 🙂

    I have now added new formulas to the file. The result does not match the manual specifications, as there were already errors in here.

    I also tidied up so that no connected cells were left in the table.

    Have a look at it and see if it corresponds to your ideas.

     

8 Replies

  • porridge 

    =LET(recipe,TRANSPOSE(FILTER(sheet3!$E$5:$G$42,sheet3!$C$5:$C$42=sheet2!D$4)),ingredient,TRANSPOSE(FILTER(sheet3!$E$5:$G$42,sheet3!$C$5:$C$42=sheet2!$B6)),IFERROR(TEXTJOIN(", ",,FILTER(ingredient,(recipe="")*(ingredient<>""))),"NA"))

    If anyone wants to pull the ingredients (milk, mustard, eggs) which are in the side dish but not in the main dish this formula maybe returns the expected result. In order to simplify the solution i adapted the table containing the allergens to this (This is done easily with IF function):

      

    The result would be like this with the main dish in horizontal order in rows 4 and 5 and the side dish in columns B and C:

    • porridge's avatar
      porridge
      Copper Contributor
      I just went through this file. As I am still learning EXCEL, I have to mention that I have never used the LET function. But thank you so much for using it and showing me these results. It's perfectly done, I understood the use of the IF function. Thank you so much kind sir for this work. I will try to work on this again, but with different parameters to master it. Thank you again!!!
  • mathetes's avatar
    mathetes
    Silver Contributor

    porridge 

     

    Unfortunately, that image doesn't provide much help in understanding how you array your information in that table. So it's hard to give much in the way of the "direction pointing" that you're seeking. 

     

    One suggestion: look into the new FILTER function. It can do quite a few things that VLOOKUP can't.

     

    If you can't resolve your situation with that, could I suggest you come back and post either the actual spreadsheet you gave there (or a mockup without revealing any actual recipes, but enough to appreciate how you are organizing the info on those allergens...... if you can't post the XLSX file here, post it on OneDrive or some other cloud service, and post a link to it here.

    • porridge's avatar
      porridge
      Copper Contributor

      mathetes 

       

      In this 1st pic, I have the recipes down and sideways, then in the middle, I am trying to find the answer to that allergen that isn't common with the other recipe. For example, recipe 1 has milk and eggs only no mustard, so when I am cooking my next recipe 2 which consists of mustard and eggs, the answer I  should get in the middle cell should be milk only (because milk is not part of recipe 2) (But if I am going from recipe 2 to recipe 1, then the answer should change to the allergen mustard, as there's mustard in 2nd and not in 1st recipe) 

      The 2nd pic is the data from which I have to get the answer. (only the 1st table in the pic should be considered)

      I hope I was able to explain the situation clearly. :))

       

      till then I would try the FILTER FUNCTION. 

      • dscheikey's avatar
        dscheikey
        Bronze Contributor

        Hi porridge

        I have tried to understand your problem. I also approached the matter with FILTER(). But I also need an auxiliary column (column "R") Please do not delete it. If you move it, the formulas have to be adjusted with INDIRECT(). Please have a look at it and see if it suits your needs.

Resources