SOLVED

Match two values in two cells of a same row and return the value in a third cell

%3CLINGO-SUB%20id%3D%22lingo-sub-2790528%22%20slang%3D%22en-US%22%3EMatch%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2790528%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20There%2C%20I%20hope%20everyone%20fine%20there.%20I%20am%20at%20beginner%20level%20using%20Excel%202019%20on%20MacBook%20Air.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20come%20across%20a%20situation%3A%3C%2FP%3E%3CP%3EI%20have%20created%20a%20data%20base%20using%20Hierarchies.%20if%20value%20is%20selected%20in%20cell%20A1%20and%20another%20value%20is%20selected%20in%20Cell%20B1.%20I%20want%20excel%20to%20compare%20these%20two%20values%20and%20return%20the%20value%20in%20C1.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20Example%3A%3C%2FP%3E%3CP%3EA1%20%3D%20A%3C%2FP%3E%3CP%3EB1%20%3D%20B%3C%2FP%3E%3CP%3Ethan%20C1%20should%20be%20%3D%20C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2790528%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20on%20Mac%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2792223%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2792223%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1168415%22%20target%3D%22_blank%22%3E%40Awais7376%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDo%20you%20mean%20in%20C1%20it%20shall%20be%20some%20formula%20which%20returns%20value%20based%20on%20values%20in%20A1%20and%20B1%20%3F%20If%20so%20why%20%22C%22%20shall%20be%20returned%2C%20not%20%22D%22%20or%20%22Z%22%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2792492%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2792492%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1168415%22%20target%3D%22_blank%22%3E%40Awais7376%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20formula%20is%20always%20placed%20in%20the%20destination%20cell%20and%20sets%20the%20rules%20by%20which%20the%20value%20returned%20is%20to%20be%20calculated.%26nbsp%3B%20A%20general%20method%20might%20be%20through%20the%20use%20of%20a%202D%20lookup%20table.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20623px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313370i2608C0CAE920357E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Ebut%20IF%20formulas%20would%20also%20offer%20a%20solution%20in%20some%20cases.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2805485%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2805485%22%20slang%3D%22en-US%22%3Ethanks%20for%20reply.%20you%20have%20picked%20up%20correctly.%20I%20used%20C%20just%20for%20example.%20it%20may%20be%20any%20value%20resulting%20from%20combination%20of%20A%20and%20B%20according%20to%20the%20data%20provided%20to%20excel.%3CBR%20%2F%3Esometime%2C%20it%20may%20be%20A%20and%20C%20in%20both%20cells%2C%20so%20excel%20should%20look%20for%20the%20resultant%20value%20from%20with%20in%20the%20provided%20data%20and%20return%20the%20value%20in%20C1.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2805486%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2805486%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1168415%22%20target%3D%22_blank%22%3E%40Awais7376%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThank%20you%2C%20but%20I%20still%20don't%20catch%20what%20is%20the%20logic%20to%20generate%20%22%3CSPAN%3E%26nbsp%3Bresulting%20from%20combination%20of%20A%20and%20B%22.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ELet%20assume%20in%20A1%20is%2010%20and%20in%20B1%20is%2011%3B%20or%20in%20A1%20is%20%22Joe%22%20and%20in%20B1%20is%20%22Mary%22%20-%20what%20shall%20be%20returned%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2805679%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2805679%22%20slang%3D%22en-US%22%3Ethat%20whole%20stats%20has%20been%20already%20provided%20to%20excel.%20for%20example%3A%20I%20have%20fed%20this%20whole%20data%20into%20the%20excel%20that%20if%20A1%20is%20Joe%20and%20B1%20is%20Mary%20than%20answer%20should%20be%20smith.%20if%20I%20change%20Mary%20to%20Shela%20in%20B1%20than%20answer%20should%20be%20Jack.%20excel%20should%20find%20the%20answer%20with%20in%20the%20data%20which%20has%20already%20been%20provided.%20I%20hope%20I%20could%20make%20it%20clear............%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2805706%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2805706%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1168415%22%20target%3D%22_blank%22%3E%40Awais7376%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIs%20it%20possible%20to%20share%20sample%20file%3F%20It's%20not%20clear%20where%20provided%20data%20is%20located%20and%20in%20which%20form.%20In%20particular%20how%20Joe%20and%20Mary%20are%20connected%20to%20Smith%20in%20these%20records.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2844342%22%20slang%3D%22en-US%22%3ERe%3A%20Match%20two%20values%20in%20two%20cells%20of%20a%20same%20row%20and%20return%20the%20value%20in%20a%20third%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2844342%22%20slang%3D%22en-US%22%3Ehi%20Mr%20Baklan%2C%20really%20grateful%20for%20your%20quick%20and%20helpful%20responses.%20can%20you%20resolve%20another%20little%20problem.%20I%20have%20created%20few%20lists%20with%20names%20like%20%22a%2C%20b%2C%20c%2C%20101%2C%20202%22.%20I%20have%20noticed%20that%20excel%20always%20put%20%22_%22%20after%20C%20and%20before%20the%20numerics.%20.e.g.%20%22c_%22%20%22_101%22.%20why%20that%20happens%20and%20how%20to%20correct%3F%20Thanks%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi There, I hope everyone fine there. I am at beginner level using Excel 2019 on MacBook Air. 

I have come across a situation:

I have created a data base using Hierarchies. if value is selected in cell A1 and another value is selected in Cell B1. I want excel to compare these two values and return the value in C1.

 

For Example:

A1 = A

B1 = B

than C1 should be = C

10 Replies

@Awais7376 

Do you mean in C1 it shall be some formula which returns value based on values in A1 and B1 ? If so why "C" shall be returned, not "D" or "Z" ?

@Awais7376 

The formula is always placed in the destination cell and sets the rules by which the value returned is to be calculated.  A general method might be through the use of a 2D lookup table.

image.png

but IF formulas would also offer a solution in some cases.

best response confirmed by Awais7376 (Occasional Contributor)
Solution
thanks for reply. you have picked up correctly. I used C just for example. it may be any value resulting from combination of A and B according to the data provided to excel.
sometime, it may be A and C in both cells, so excel should look for the resultant value from with in the provided data and return the value in C1.

@Awais7376 

Thank you, but I still don't catch what is the logic to generate " resulting from combination of A and B".

Let assume in A1 is 10 and in B1 is 11; or in A1 is "Joe" and in B1 is "Mary" - what shall be returned?

that whole stats has been already provided to excel. for example: I have fed this whole data into the excel that if A1 is Joe and B1 is Mary than answer should be smith. if I change Mary to Shela in B1 than answer should be Jack. excel should find the answer with in the data which has already been provided. I hope I could make it clear............

@Awais7376 

Is it possible to share sample file? It's not clear where provided data is located and in which form. In particular how Joe and Mary are connected to Smith in these records.

hi Mr Baklan, really grateful for your quick and helpful responses. can you resolve another little problem. I have created few lists with names like "a, b, c, 101, 202". I have noticed that excel always put "_" after C and before the numerics. .e.g. "c_" "_101". why that happens and how to correct? Thanks
For a start there are 17 billion potential names that are not available because they are cell references. Then another 17 billion to avoid the R1C1 cell references. You can't start a name with a number or use most symbols in a defined name. The underscores are just Excel getting around the rules.
A further note. If your multitude of names reference rows and columns of the data then
= (C_ _101)
will be the cell at the intersection of the two ranges.
Thanks for a comprehensive answer. I am obliged.
would you mind resolving another query of mine.
I have created a hierarchy. in cell A1, if I select "Alpha" then in cell B1, elements of list "Alpha" are displayed. now I want that in cell C1 (or any other cell), the same "Alpha of A1" should correspond to an other list (we may call it "Bravo"). is it possible???