Look up a corresponding text value based on a unique number in a range of numbers

I have a range of unique numbers that say are located in the range A2:D100, and corresponding text values are in the header of the range in A1:D1. What's the best way to return the text value based on the unique number. I realized I can't do it with SUMPRODUCT lookup since sumproduct lookups don't return text values.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you looked at the function vlookup() and hlookup()

Not sure I understand your question, but I suspect one or the other of these functions will do what you want --


tyler43Author Commented:
To illustrate:

Dog               Cat              Mouse
0.2570      0.5804      0.9788
0.6996      0.3740      0.7969
0.8522      0.4584      0.6056
0.4455      0.5940      0.0239
0.9675      0.0059      0.8557
0.8891      0.9361      0.3796
0.3450      0.7439      0.4690
0.9793      0.0408      0.6457

I need to return text from the first row based on a unique number within a range, so for 0.5940 lookup will return "Cat".
Glenn RayExcel VBA DeveloperCommented:
What if the numeric value exists in more than one column?
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Glenn RayExcel VBA DeveloperCommented:
Here is a solution that will return the column name if unique values exist.

If your data range is in columns A:C and the value you are looking for is in cell E2, enter this formula:
=IFERROR(INDEX($A$1:$C$1,1,SUMPRODUCT(($A$1:$C$20=$E$2)*(COLUMN($A$1:$C$20)))),"Not Found")

I only extended this to 20 rows; you can change that value as appropriate.

See example workbook.  

tyler43Author Commented:
Numeric values are totally unique and don't repeat in this specif situation.
Glenn RayExcel VBA DeveloperCommented:
Slightly simpler solution; shortens the COLUMN reference:
=IFERROR(INDEX($A$1:$C$1,1,SUMPRODUCT(($A$1:$C$20=$E$2)*(COLUMN(A:C)))),"Not Found")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tyler43Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for tyler43's comment #a40244251

for the following reason:

Works like a charm! Thanks!
Glenn RayExcel VBA DeveloperCommented:

If my answer was acceptible, can you please click the "Accept this solution" above my previous post with the correct solution?  That will properly close the question and make it available to other EE users.

tyler43Author Commented:
sorry I think I did something wrong initially while trying to close the question
Glenn RayExcel VBA DeveloperCommented:
Thanks for accepting my solution; I'm glad I was able to help.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.