# can't find a formula that works for multiple conditions

hello

i can't find a way to put to work the following statement

if C2 value is in H2:H1000 put value of H1 in D2; if C2 value is in I2:I1000 put value of I1 in D2; if C2 value is in J2:J1000 put value of J1 in D2

Excel has any way to make such condition in a single cell?

BR
Rui
###### Who is Participating?

x
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.

Excel & VBA ExpertCommented:
Maybe this......

``````=IF(ISNUMBER(MATCH(C2,\$H\$2:\$H\$1000,0)),H1,IF(ISNUMBER(MATCH(C2,\$I\$2:\$I\$1000,0)),I1,IF(ISNUMBER(MATCH(C2,\$J\$2:\$J\$1000,0)),J1,"")))
``````

Experts Exchange Solution brought to you by

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

Commented:
Put this in D2:
=+IF(ISERROR(MATCH(C2,H2:H1000,0))=FALSE,H1,IF(ISERROR(MATCH(C2,I2:I1000,0))=FALSE,I1,IF(ISERROR(MATCH(C2,J2:J1000,0))=FALSE,J1,"No Match Found")))
Project EngineerCommented:
If you explain your problem more detailed, you may get more general / higher quality answers.
This is for cell D2
``````=IF(COUNTIF(OFFSET(\$H\$1;1;0;1000;1);\$C\$2);\$H\$1;IF(COUNTIF(OFFSET(\$I\$1;1;0;1000;1);\$C\$2);\$I\$1;IF(COUNTIF(OFFSET(\$J\$1;1;0;1000;1);\$C\$2);\$J\$1;0)))
``````
Or, half evaluated version
``````=IF(COUNTIF(\$H\$2:\$H\$1000;\$C\$2);\$H\$1;IF(COUNTIF(\$I\$2:\$I\$1000;\$C\$2);\$I\$1;IF(COUNTIF(\$J\$2:\$J\$1000;\$C\$2);\$J\$1;0)))
``````
Project EngineerCommented:
This is an another trial for D2.
This will first find in which column your data is. But it needs the value you search to be unique.
This formula can easily be extended for more columns.
``````=INDEX(\$H\$1:\$J\$1;SUM(MMULT(--(\$H\$2:\$J\$1000=\$C\$2);ROW(INDIRECT("1:"&COLUMNS(\$H\$1:\$J\$1))))))
``````
Older than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
###### 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.