Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports

# Thread: If cells in a column contain chosen text then print other text in adjacent cell.

1. I agreed to these rules
Join Date
5th October 2011
Posts
3

## If cells in a column contain chosen text then print other text in adjacent cell.

I have a spread sheet that is about 8000 rows. I need code to check if cells in Column D contain certain text (in this case: \$50) and if so print this text: ___ \$100 into the adjacent cell in Column E.

D E
\$40
\$30
\$10
\$50 ___\$100
\$10
\$50 ___\$100

Excel Video Tutorials / Excel Dashboards Reports

2. Development Team Member
Join Date
26th July 2011
Posts
544

## Re: If cells in a column contain chosen text then print other text in adjacent cell.

Put this formula into E2 and fill down

=IF(D2="\$50","___ \$100","")

Then use copy and paste values

Excel Video Tutorials / Excel Dashboards Reports

3. I agreed to these rules
Join Date
5th October 2011
Posts
3

## Re: If cells in a column contain chosen text then print other text in adjacent cell.

Bare with me, I'm a newbie at this.

That does work, but if I paste the formula down I would have that formula in cells that are not true. Is there a way to setup up layers so that if the statement is false(column B is something other than \$50) it would paste another value down? Essentially, I have other values that should be pasted based on the first column.

I have a feeling that a macro is needed for this.

 \$50 ____ \$100 \$2 \$70 \$70 \$23

Excel Video Tutorials / Excel Dashboards Reports

4. ## Re: If cells in a column contain chosen text then print other text in adjacent cell.

I have other values that should be pasted based on the first column
Why not provide *ALL* of the details from the start? You'll get a more accurate answer sooner.

To get the most precise answers, it is best to upload a sample workbook (sensitive data scrubbed/removed) that shows a few manually created examples of the desired results.
The structure and data types of the workbook must exactly match that of the real workbook. Include in the workbook a clear and explicit explanation of all requirements.The sample workbook only needs to contain enough data to illustrate the need to aid with developing the solution.

1. Click the EDIT POST in the gray band immediately below your post
3. Edit the post or thread title
4. To upload: scroll down to Manage Attachments -- use ZIP compression if necessary to meet file size limitations
-----------------------------------------------------

=LOOKUP(D2,{10,50,70},{"___If it's ten","____\$100","___if it's 70"})

Replace the "___if it's . . ." with whatever you need. Adjust the number values in the array {10,50,70} as required.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
porno