if command

Adrian1

Board Regular
Joined
Dec 30, 2003
Messages
126
Hi,

I need to a formula to give a specific value to a cell.

Cell A2 is blank

I want a formula in cell C1 to add the the text "Quote" in cell A2 if cell A1 has the text "HH" or "NHH" contained in it and if A1 doesn't have "HH" or "NHH" in it then A2 needs to stay blank.

Thank you in advance to anyone who can help.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hello,

Dont understand why you want the formula in C1.

Why not just put this formula in A2?

=IF(OR(A1="NN",A1="NHH"),"Quote","")

Is this no good?
 
Upvote 0
Adrian1 said:
...

I need to a formula to give a specific value to a cell.

Cell A2 is blank

I want a formula in cell C1 to add the the text "Quote" in cell A2 if cell A1 has the text "HH" or "NHH" contained in it and if A1 doesn't have "HH" or "NHH" in it then A2 needs to stay blank...

A formula in C1 cannot add the text "Quote" or anything else for that matter to A2.
 
Upvote 0
Hi

That works if A1 is NHH or HH, but there are other combinations that need to be covered. Eg, A1 may have the text HH 12 MONTH in it (in which case A2 needs to be "quote" or A1 may also have NHH 24 MONTH in it and so on. I need the formula to determine whether or not any part of cell A1 has NHH or HH contained in it.

Sorry, I wasn't very clear in the first instance.
 
Upvote 0
The problem here is that the only ways to put things into cell A2 are --

A] by formulas in A2, or
B] via VBA, or
C] artificially, through formatting

Note tat with C], the "added" bit looks as if it is there but is not part of the cell alue.
 
Upvote 0
Try:

=IF(ISNUMBER(SEARCH("HH",A1)),"QUOTE","")

That will find HH wherever it is in the text.
 
Upvote 0
Hello,

Try this formula

=IF(ISERROR(FIND("NN",A1)),IF(ISERROR(FIND("NHH",A1)),""),"Quote")

is this working OK?
 
Upvote 0

Forum statistics

Threads
1,202,987
Messages
6,052,932
Members
444,616
Latest member
novit19089

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top