Formula If Cell Contains Text - Google Sheets

KatieTrev

New Member
Joined
May 9, 2024
Messages
1
Office Version
  1. Prefer Not To Say
Platform
  1. Windows
Hello,

I'm trying to workout a formula to:

- If cell A1 contains the text "test text", then make cell H1 return the word "hello"
- I still want to be able to type other text into cell H1 if required, so I'm not looking at inputting the formula directly into cell H1
- Can I add in a formula into another cell to control cell H1 based on A1's text?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Would you be open to having something like a manual override cell, typing in that cell instead of H1 directly?

For example, you could have K1 set up as a manual override cell with a formula:
Excel Formula:
=IF(K1<>"", K1, IF(ISERROR(SEARCH("test text",A1)), "", "hello"))

If you type something into K1, then the formula uses that. If you don't, it will search for "test text" in A1 and place "hello" in H1 if it finds it. Otherwise it leaves the cell blank. If you don't want to see the text in H1, you could always make the text the same color as the background.

If that doesn't work for you, you might have to do some VBA in the Change events, and that's the kind of thing that will slow down the spreadsheet because it will perform those VBA instructions for any change you make to the sheet, every single time.
 
Upvote 0
If that doesn't work for you, you might have to do some VBA in the Change events, and that's the kind of thing that will slow down the spreadsheet because it will perform those VBA instructions for any change you make to the sheet, every single time.
Google Sheets does NOT have VBA.

(Note the thread title and the forum this thread is in. This is a Google Sheets question, not an Excel one!)
 
Upvote 0
Google Sheets does NOT have VBA.

(Note the thread title and the forum this thread is in. This is a Google Sheets question, not an Excel one!)
Whoops! I thought I was only in the Excel forum. I'm sorry I can't delete or change my post.
 
Upvote 0
Whoops! I thought I was only in the Excel forum. I'm sorry I can't delete or change my post.
Did you happen to find the thread using the "Unanswered threads" listing?
Note that contains more then just Excel forum questions:

1715353048802.png


Note that Excel and Google Sheets have many similarities, as well as many differences.
Since many of the functions are the same (but not all), your formula may or may not work in Google Sheets.
Someone who has Google Sheets would have to test it out and let us know (i.e. the original poster or someone else).
I do not use it myself.
 
Upvote 0
Did you happen to find the thread using the "Unanswered threads" listing?
Note that contains more then just Excel forum questions:

View attachment 111227

Note that Excel and Google Sheets have many similarities, as well as many differences.
Since many of the functions are the same (but not all), your formula may or may not work in Google Sheets.
Someone who has Google Sheets would have to test it out and let us know (i.e. the original poster or someone else).
I do not use it myself.
Yes, I meant to click Unanswered threads in the Excel forum but got sloppy. I'll watch for that from now on.
 
Upvote 0
Yes, I meant to click Unanswered threads in the Excel forum but got sloppy. I'll watch for that from now on.
That isn't possible. "Unanswered threads" is a global listing, no matter where you click it from.
Note that it is in the menu bar, and not under any particular forum.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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