LEFT Worksheet function

  • Thread starter Thread starter loren.pottinger
  • Start date Start date
L

loren.pottinger

=IF(LEFT(G7,2) = 17,"Dep", "Amort")

I constructed the above function to return Dep if the first two digits
starting from the leftmost digit in cell G7 is 17 and return Amort
otherwise, please help. This formula looks so right to me.
 
Try:

=IF(VALUE(LEFT(G7,2) )= 17,"Dep", "Amort")

if G7 is text

=IF(LEFT(G7,2) = "17","Dep", "Amort")

HTH
 
If G7 is text or numbers, putting 17 in quotation marks will return the right
answer.

So, all that is neede is =IF(LEFT(G7,2)="17","Dep","Amort")

From what I can tell, LEFT treats any string of characters as text, even if
they are formatted differently than text.

Dave
 
Try:

=IF(LEFT(G7,2) = "17","Dep", "Amort")

or

=IF(--LEFT(G7,2) = 17,"Dep", "Amort")

Regards

Trevor
 
The function LEFT expects text data. Its argument (which I suspect is a
number) should therefore be first converted to text.
Also the quantity it is compared to (namely 17) should be presented as text,
that is "17".

Try this:
=IF(LEFT(TEXT(G7,"#"),2) = "17","Dep", "Amort")
 
Well, the --LEFT(G7,2) tip is really clever !

Trevor Shuttleworth said:
Try:

=IF(LEFT(G7,2) = "17","Dep", "Amort")

or

=IF(--LEFT(G7,2) = 17,"Dep", "Amort")

Regards

Trevor
 
All,

I am baffled none of those work. They only return dep or Amort for all
the cells regardless of what is in column G.
 
The formula I give you above worked for me.

What happens if you use the formula I give you and then you press F9 (which
forces Excel to recalculate)?

Any luck?
 
Oooops. My bad it is working. Thank you.


Dave said:
The formula I give you above worked for me.

What happens if you use the formula I give you and then you press F9 (which
forces Excel to recalculate)?

Any luck?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top