Essex
Essex

Reputation: 6128

VBA if value in cell display string in other cell

I'm trying to set some things in my Excel in order to improve my process. I would like to create a VBA function which let to display value in cell B13 if cell B11 contains "_01_Clients_Particuliers" and cell B12 contains "_00". These cells are dropdown list.

I never use VBA up to now.

I could write into the cell B13 :

=IF(COUNTIF(B11,"_01_Clients_Particuliers"),"_100PRD05","")

But I need to take into account two cells and I assume I need to use VBA to do that, because the cell B14 has already a formula : =INDIRECT(B13)

enter image description here

Do you have any idea ?

Upvotes: 0

Views: 174

Answers (2)

Axionatic
Axionatic

Reputation: 671

Unless I've misunderstood your question, I don't think you need VBA to do this. Check out Using IF with AND, OR and NOT functions Again, apologies if I'm mistaken, but it seems that your desired result could be produced with the following formula in B13:

IF(AND(B11 = "_01_Clients_Particuliers", B12 = "_00"), "_100PRD05","")

This will put the value "_100PRD05" in B13 if B11 equals "_01_Clients_Particuliers" and B12 equals "_00".

Upvotes: 0

Kin Siang
Kin Siang

Reputation: 2699

Assuming you drop-down list only contain few selection, then the following formula should be work for you.

=IF(AND(ISNUMBER(SEARCH(H1,C1)),ISNUMBER(SEARCH(H2,C2))),"It is there","not found")

enter image description here

In addition, you will write the range reference directly, it will return error in my case

enter image description here

Upvotes: 0

Related Questions