Stuck on simple formula.

PACULA

New Member
Joined
Aug 12, 2020
Messages
6
Could you some help, a co-worker and I have been stuck forever on this.

Jungle.JPG


When the Location is the Jungle and the Country US AND the description is EITHER Tiger or Lion, return Animal. Otherwise, return column B (not found).

In the green section I can get Animal but the formula always returns FALSE if any of the conditions isn't true instead of not found.

Formula is below...what am I doing wrong?

=IF(AND(A2="Jungle",LEFT(D2,2)="US"),IF(ISNUMBER(SEARCH("Lion",N2)),"Animal",IF(AND(A2="Jungle",LEFT(D2,2)="US"),IF(ISNUMBER(SEARCH("Tiger",N2)),"Animal",IF(AND(A2="Jungle",LEFT(D2,2)="US"),B2)))))
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
this seems to work

VBA Code:
=IF(AND(OR(N2="Tiger",N2="Lion"),A2="Jungle",D2="US"),"Animal",B2)
 
Upvote 0
Thanks for responding. My example was too simple.

Dog is only a part of the description below.

That seems to be the issue and I'm not sure how to address with the formula...note that the green highlight should be either Dog or Cat, but I can't get one formula that does both; I always end up with a "False" instead of Cat.

Dog.JPG


The rule I'm trying to do is if DogUS is found in the Type and the word Dog is in the description, return Dog. Otherwise, return Rollup (Cat in the example).

=IF(AND(A3="Dog",LEFT(D3,2)="US"),IF(ISNUMBER(SEARCH("Dog",E3)),"Dog",B3))

The actual formulas are much longer, but if I can just get this building block right I can construct from there.
 
Upvote 0
if A2 is blank the answer will be Cat?

=IF(ISBLANK(A3),B3,IF(AND(A3="Dog",LEFT(D3,2)="US"),IF(ISNUMBER(SEARCH("Dog",E3)),"Dog",B3)))

if the above doesn't work can you please provide a bigger data sample
 
Upvote 0
Thanks for responding. My example was too simple.

Dog is only a part of the description below.

That seems to be the issue and I'm not sure how to address with the formula...note that the green highlight should be either Dog or Cat, but I can't get one formula that does both; I always end up with a "False" instead of Cat.

View attachment 20174

The rule I'm trying to do is if DogUS is found in the Type and the word Dog is in the description, return Dog. Otherwise, return Rollup (Cat in the example).

=IF(AND(A3="Dog",LEFT(D3,2)="US"),IF(ISNUMBER(SEARCH("Dog",E3)),"Dog",B3))

The actual formulas are much longer, but if I can just get this building block right I can construct from there.
You'r missing a little part in the Formula (Bold in end of Formula): =IF(AND(A3="Dog",LEFT(D3,2)="US"),IF(ISNUMBER(SEARCH("Dog",E3)),"Dog",B3);B3)
 
Upvote 0
Thanks David. The formula should return the Rollup when any value (blank or otherwise) doesn't say DogUS (combination of Type and Group) and have Dog in the Description.

Thanks Ebea. I tried your suggestion but no luck...didn't work with the ;B3 at the end...Excel changed it to :B3 and still returned false.

Simplified view below. I really just need to figure out the formula for row 3...if I can get it to return either Dog or Cat every time...never False...I should be set. Any thoughts?


Capture.JPG
 
Upvote 0
Thanks David. The formula should return the Rollup when any value (blank or otherwise) doesn't say DogUS (combination of Type and Group) and have Dog in the Description.

Thanks Ebea. I tried your suggestion but no luck...didn't work with the ;B3 at the end...Excel changed it to :B3 and still returned false.

Simplified view below. I really just need to figure out the formula for row 3...if I can get it to return either Dog or Cat every time...never False...I should be set. Any thoughts?


View attachment 20175
If you failed with this corrected Formula, then you'r example in #3, are not what you in reality have. I made the test out of #3, and it works. Test it with Excels Evaluate tools, in section Formula.
I can't see, how Excel should change the ; to a :
 
Upvote 0
@ebea has the answer but i think but it looks like a typo gets in there somewhere... and when you've corrected it in the picture in post #6 its not got the final B3 needed

=IF(AND(A3="Dog",LEFT(D3,2)="US"),IF(ISNUMBER(SEARCH("Dog",E3)),"Dog",B3),B3)

1597216709462.png
 
Upvote 0
If you failed with this corrected Formula, then you'r example in #3, are not what you in reality have. I made the test out of #3, and it works. Test it with Excels Evaluate tools, in section Formula.
I can't see, how Excel should change the ; to a :
change the ; or : to a ,
 
Upvote 0
Ebea, I'm new to this board (as a poster, anyways) and hope that I'm ok in posting a link to my file on Google Drive. If I'm supposed to follow another process, happy to.

If you try to input the formula suggested, you'll see the error message/suggested correction. If the correction is made, it's still false. If the correction isn't made, the formula fails.

MREXCEL file
 
Upvote 0

Forum statistics

Threads
1,215,544
Messages
6,125,444
Members
449,226
Latest member
Zimcho

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top