Formula if cell contains certain letter?

b34r

New Member
Is there a formula in 2003 I could use that let's me perform a different equation if a cell contains a certain letter? eg:

"3400A"
"3400B"

Is there a way to use the IF function to say "If cell contains letter "B", multiply it by "reference cell", if not, just leave it. ?

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You won't be able to multiply cells containing text but you could use something like

=IF(ISNUMBER(FIND("B",A1)),1,0)

which will return 1 if A1 contains B or 0 otherwise.

oh, no, didnt mean to state i wanted to multiply the text cell...wanted to multiply a number cell by another number cell in the same row, which seemed to work - thanks!

could i do the same thing, but say if the cell contains a "b" or a "c" then do something, if not, leave it?

Try

=IF(OR(ISNUMBER(SEARCH("B",A1)),ISNUMBER(SEARCH("C",A1))),1,0)

Try

=IF(OR(ISNUMBER(SEARCH("B",A1)),ISNUMBER(SEARCH("C",A1))),1,0)

if i wanted"B" to return 1 and "C" to return 2, how would i do that? thanks.

You won't be able to multiply cells containing text but you could use something like

=IF(ISNUMBER(FIND("B",A1)),1,0)

which will return 1 if A1 contains B or 0 otherwise.

whats the difference between

=IF(ISNUMBER(FIND("B",A1)),1,0) and
=IF(ISNUMBER(Search("B",A1)),1,0)

just checked and noticed Finds its case sensitive, is that the only difference

if i wanted"B" to return 1 and "C" to return 2, how would i do that? thanks.

Can anyone else help with this query? I'm stuck on an important assignment!

I'm no expert, but I think if you nest the Find function you could achieve that.

=IF(ISNUMBER(FIND("B",A1)),1,IF(ISNUMBER(FIND("C",A1)),2,0))

With a quick test it produced these results:

[TR] [TD]Input[/TD] [TD]Output[/TD] [/TR] [TR] [TD]310A[/TD] [TD]0[/TD] [/TR]
[TD]310B[/TD] [TD]1[/TD] [/TR]
[TD]310C[/TD] [TD]2[/TD] [/TR]

Hope this helps,

Phil

Replies
5
Views
138
Replies
3
Views
248
Replies
3
Views
170
Replies
5
Views
435
Replies
3
Views
82

1,214,277
Messages
6,118,635
Members
448,844
Latest member
Jayee04e

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.

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

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