# Formula not evaluating as expected

#### Foo_Man_Chu

##### Board Regular
I have this formula:

Code:
``=IF(AND(B1="HERE",LEFT(D3,7)="STC|A2:"),C3="HERE","")``

It didn't return the expected result of C3 = "HERE" so I evaluated it. For some reason these two parts of the formula evaluate to TRUE:

Code:
``AND(B1="HERE",LEFT(D3,7)="STC|A2:")``

but overall the formula evaluates to false. I know this isn't that hard of a formula but I'm completely stumped. Can someone help me out please? Thanks in advance.

### Excel Facts

Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

##### Well-known Member
Are you testing to see if C3 = "HERE" or that's what you want it to equal under a certain condition? A formula can only return a value in C3 if it's written in C3.

=IF(AND(B1="HERE",LEFT(D3,7)="STC|A2:",C3="HERE"),"")

otherwise:

=IF(AND(B1="HERE",LEFT(D3,7)="STC|A2:"),"HERE","")

Last edited:

#### shg

##### MrExcel MVP
Formulas return a result to the cell in which they appear.

=IF(AND(B1="HERE",LEFT(D3,7)="STC|A2:"),"HERE","")

#### philwojo

##### Well-known Member
You are getting False because after the "AND" comes back as true you are doing another evaluation of C3="Here", and that is what is giving you the FALSE.

If you are trying to populate cell C3 with the word "Here" using this IF statement then you need to put the formula into cell C3, you don't need to call it out. So if you put this in C3 what do you get, is it what you want?

Code:
``[COLOR=#333333]=IF(AND(B1="HERE",LEFT(D3,7)="STC|A2:"),"HERE","")[/COLOR]``

Replies
0
Views
30
Replies
10
Views
176
Replies
6
Views
81
Replies
4
Views
54
Replies
2
Views
68