1

So, I have a Product that is made of multiple materials, labeled with material IDs. I need to pull the multiple material IDs from the cell and find their associated costs from another table, and then sum them all up to find the total production cost. This is easy to do when there is only one material needed for the product with a simple xlookup, however when there are multiple material IDs it doesn't work. This is for a little made up project where I'm starting a business selling jewelry. I apologize if the answer is very simple, I am not an Excel expert. Anyhow the help is appreciated, thank you!

I know I could work around this by first making a third table only for finding the production cost and having each material ID in its own cell, but I was really hoping I could find a way to avoid this and figure out how to xlookup and sum multiple materials based on their ID from one cell.

As you can see in cell K12 the necklace is made up of 3 different materials (three material IDs). How do I xlookup the three and sum them for the total production cost?

Here is a photo for reference: Excel Photo

And here is my code for the "Production Cost" column:

=SUM(XLOOKUP([@[Material IDs Needed]],Table1[Material ID],Table1[Material Cost]))

2 Answers 2

1

This formula uses VLOOKUP and TEXTSPLIT. Replace ranges with columns' name reference if needed.

=SUM(VLOOKUP(VALUE(TEXTSPLIT(K4,",")),B$4:D$12,3,FALSE))

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I like using xlookup so I exchanged it but it worked perfectly thanks a lot. Here's what I have: =SUM(XLOOKUP(VALUE(TEXTSPLIT(K4,",")),Table1[Material ID],Table1[Material Cost]))
0

If you have Microsoft 365, you could define (Formulas > Define Name) functions for easier maintenance:

Define names:

fxGetIds =LAMBDA(ids, TEXTSPLIT(ids,","))
fxLookupCost =LAMBDA(id, XLOOKUP(VALUE(id),Table1[Marterial ID],Table1[Material cost],0))
fxCost =LAMBDA(ids,SUM(MAP(fxGetIds(ids), LAMBDA(id, fxLookupCost(id)))))

Then in Production Cost column

=fxCost([@[Material Ids Needed]])

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.