Populating Cells Automatically If Other Cell Contains Specific Text

mattwolves

New Member
Joined
Mar 9, 2018
Messages
7
Hi folks, I'm hoping someone can help me with with my query.
I'm new to the site so please be gentle :)
I'm trying to write a spreadsheet for instructing someone to raise a purchase order if a cell is populated.
For example Sheet 1 would look like this below
[TABLE="width: 500"]
<tbody>[TR]
[TD]Reference (column a)[/TD]
[TD]Raise Order (column b)[/TD]
[/TR]
[TR]
[TD]828282[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]837489[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]354739[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]838483[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]838482[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]838481[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]838488[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]838480[/TD]
[TD]yes[/TD]
[/TR]
[TR]
[TD]838489[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

With Sheet 2 looking something like below. Is there a way without using VBA to populate cells in column a with the reference number of column a from sheet 1 if column b (in sheet 1) has "yes"?
[TABLE="width: 500"]
<tbody>[TR]
[TD]Reference (column a)[/TD]
[TD](column b)[/TD]
[/TR]
[TR]
[TD]837489[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]838483[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]838480[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Hope I've explained myself well.
Thanking you in advance
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I've got my sheet set up like your example:
AB
ReferenceRaise Order
yes
yes
yes

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]828282[/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]837489[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]354739[/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]838483[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]838482[/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]838481[/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]838488[/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]838480[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]838489[/TD]
[TD="align: right"][/TD]

</tbody>


And here's how I set up sheet 2:
(Just copy the formula in A2 down to the rest of the cells in the column)


A
Reference
=IF(Sheet1!B2="yes",Sheet1!A2,"")
=IF(Sheet1!B4="yes",Sheet1!A4,"")
=IF(Sheet1!B6="yes",Sheet1!A6,"")
=IF(Sheet1!B7="yes",Sheet1!A7,"")
=IF(Sheet1!B8="yes",Sheet1!A8,"")
=IF(Sheet1!B10="yes",Sheet1!A10,"")

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]=IF(Sheet1!B3="yes",Sheet1!A3,"")[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]=IF(Sheet1!B5="yes",Sheet1!A5,"")[/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]8[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]=IF(Sheet1!B9="yes",Sheet1!A9,"")[/TD]

[TD="align: center"]10[/TD]

</tbody>
Sheet2


Using VBA, we'd be able to make it look a little prettier, but this is the best way I can think of without using a macro.

You could get rid of the spaces between the rows with data by applying a filter. Select cells A1:A10 in sheet2 and press CTRL + Shift + L.

You'll see a drop-down arrow appear. Click on it, and uncheck "blanks". This will hide the blank rows to make your sheet look more presentable. If you ever need to unhide them, just click on the drop-down arrow again, and re-check "blanks".

Hope this helps!

Matt
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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