×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# If cell contains certain text then run this formula, otherwise run this formula instead

## If cell contains certain text then run this formula, otherwise run this formula instead

(OP)
Hello

G5 contains a code - could be anything but if there is a K in that code then I want, cell C19 to run a formula: value in G6 divided by 12 multiply by -1 to give a negative figure. But if there's a K in G5 then I want just G6 divided by 12.

What I have at the moment is:

=IF(G5="*K*",G6/12*1,G6/12*-1)

I've had a look round and there is ISERROR, SEARCH etc which will return True and False, but I want a math result. The asterisk for wildcard isn't working for me.

Can you tell me where I've gone wrong?

thank you for helping

____________
Pendle

### RE: If cell contains certain text then run this formula, otherwise run this formula instead

I don't think you can write a formula in a cell that puts something in other cell.

You could accomplish this with a little of VBA code...

---- Andy

There is a great need for a sarcasm font.

### RE: If cell contains certain text then run this formula, otherwise run this formula instead

(OP)
Okay thanks - no worries, I was just trying to save a bit of time, I can learn to look for the K and change the result appropriately!!

thank you for helping

____________
Pendle

### RE: If cell contains certain text then run this formula, otherwise run this formula instead

How about using the FIND() function? Not at my PC, but...

=G6/12*IF(FIND(G5,âKâ)>0,1,-1)

Skip,

Just traded in my OLD subtlety...
for a NUance!

### RE: If cell contains certain text then run this formula, otherwise run this formula instead

If G5 contains "K" then this (Skip's) formula works (flipped around Blue parts):
=G6/12*IF(FIND("K", G5)>0,1,-1)
else, (no "K" in G5) the formula returns #VALUE!

---- Andy

There is a great need for a sarcasm font.

### RE: If cell contains certain text then run this formula, otherwise run this formula instead

=G6/12*IF(IFERROR(FIND("K", G5),0)>0,1,-1)

Kind of reminds me of...

e(pi * i) + 1 = 0

Skip,

Just traded in my OLD subtlety...
for a NUance!

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!