=IF logical test to search only part of a cell

  • Thread starter Robbie in Houston
  • Start date
R

Robbie in Houston

I am trying to get the =IF function to test only part of a cell as the
logical test. I am trying to create an Invoice template for online sales.
I will only be charging sales tax for Texas residents. I need the tax
formula to only calculate tax if the state is Texas. I do not want to
separate the City, State and Zip as they are currently a single cell. For
instance,

F4 Houston, Texas 77003
F27 =SUM(F18:F26)
F28 8.25 [Format->Percentage]
F29 =F27*F28

For F29, I have tried =IF(F4="*Texas*", F27*F28, 0) but got no results. Can
I make the formula work to look for Texas only? Or is there a better way to
go about this?
 
C

CLR

If the format of F4 will always be, "CityName, Texas Zipcode",
then.........this formula should work in F29.

=IF(MID(F4,FIND(",",F4,1)+2,5)="Texas",F27*F28,0)

Vaya con Dios,
Chuck, CABGx3
 
B

Biff

Hi!

Another method that's a little more robust:

=IF(ISNUMBER(SEARCH("texas",F4)),F27*F28,0)

Biff
 

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

Top