Anbuselvam K
Member
Dear VBA Code Experts,
I need a VBA code to dynamically calculate the consumption cost for multiple companies based on matching company names, prices, and purchase quantities. The input data includes company names (B4) with their respective consumption quantities (C4) and company names (E4) linked to purchase prices (F4) and Purchase quantities (G4). The goal is to calculate the consumption KG's cost for each row in D4, ensuring that only the purchase data of the same company is applied to its consumption. The code should dynamically search and match company names between columns B and E, as the order of names may change in the future (e.g., AABBBABCAACCC). It must ensure that one company’s purchase data is not used for another company's cost calculation. The solution should handle any variation in the company order and deliver accurate results in D4 based on matching purchase and consumption data.
Using the Excel formula I calculated the expected cost in K4, K9, and K14 for each company A, B, and C for your reference. I need the VBA code to find the cost in D4:D18.
Thanks in Advance!
I need a VBA code to dynamically calculate the consumption cost for multiple companies based on matching company names, prices, and purchase quantities. The input data includes company names (B4) with their respective consumption quantities (C4) and company names (E4) linked to purchase prices (F4) and Purchase quantities (G4). The goal is to calculate the consumption KG's cost for each row in D4, ensuring that only the purchase data of the same company is applied to its consumption. The code should dynamically search and match company names between columns B and E, as the order of names may change in the future (e.g., AABBBABCAACCC). It must ensure that one company’s purchase data is not used for another company's cost calculation. The solution should handle any variation in the company order and deliver accurate results in D4 based on matching purchase and consumption data.
Using the Excel formula I calculated the expected cost in K4, K9, and K14 for each company A, B, and C for your reference. I need the VBA code to find the cost in D4:D18.
Thanks in Advance!