Title says it all pretty much, So in the image the sum looks for the first entry as it has "mr human" in the cell next to it but when i try to designate my critera range for a single cell i get #value returned, I can solve this by entering "mr human" into all the adjacent cells however to sheet I am pulling the data from has is formatted like It is shown so it would be ideal If i didnt have to make a copy then do that as this can be for several hundred "mr & Ms/miss"
Thanks for any help in advance!
First of all, I would say that you should indeed consider using a different model data for this, as suggested by @ScottCraner.
Second, this solution may work, but if you have a lot of sets (when i mean sets, i mean Mr Human, Miss Human, Kid Human, Grandp Human, and many more) it can be kind of annoying.
Now, first thing you must do is creating named ranges of each set of data. So the values related to Mr Human will be named MR_HUMAN
and values of Miss Human will be named MISS_HUMAN
. It's easy to do.
Remember:
A video example (type the name and press ENTER
Now the formula for column C:
=IFERROR(VLOOKUP(B3;CHOOSE(MATCH($A$3;{"Mr Human";"Miss Human"};0);MR_HUMAN;MISS_HUMAN);2;FALSE);"Not found")
You can see below that if I change cell A3 to Miss Human, values change properly:
This is how the formula works:
MATCH($A$3;{"Mr Human";"Miss Human"};0)
This will search the text in A3
into the array of sets and will return a number according to position. In this case, Mr Human=1
and Miss Human=2
CHOOSE(*number from step 1*;MR_HUMAN;MISS_HUMAN)
We use the number obtained in step 1 to combine with function CHOOSE, which allows to select a result based on a list. So we can use this function to relate number 1 to name MR_HUMAN
and number 2 to MISS_HUMAN
and it will return our target range with right values.VLOOKUP(B3;*name from step 2*;2;FALSE)
We combine the range from previous step and use it as matrix of a normal VLOOKUP, that will search the CODE in first column, and will return the value from second one (COST) The big issue here is that if you got a lot of datasets for more values, besides Mr Human and Miss Human , you need to adjust the MATCH and CHOOSE part, and can be annoying.
Anyways, hope this helps a little bit.
Also, consider using a different data model and the resume data using Pivot Tables.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.