Assuming A has the stock name and C has the stock quantity.
You can also have the middle term of the function reference another cell instead of static “Apple”, so you can have a dynamic formula that copies down and can return the amounts of any stock name in the target cell.
You can replace the text in that formula with whatever cell the text is in as well. For example if you’ve labeled the table you want to populate with “Apple” in cell A1, then A1 can replace “Apple” in the formula. Just make sure to anchor it correctly otherwise copying the formula out or down will go kaflooey on you.