auto fill cells with text if value of one cell meets specificcondition

A

amanda

I would like to write a macro that populates rows with different text
whose value depends upon one cell value.

For example if cell A1 = "163", then cell B1 = "BLUE' AND cell C1 =
"$2.95" AND cell D1 = "tennis ball"

Thanks for any feed back!!
 
M

Matthew Herbert

Amanda,

Have you looked at using the VLOOKUP function? If your data (i.e. the id
number, color, price, and type) is in a table, then simply use VLOOKUP. So,
you would have a VLOOKUP function in cells B1, C1, and D1. The lookup value
would reference A1, the table array would be wherever your table data is
located, the column index would correspond to the appropriate table column of
the data you want returned (where column 1 has the same type of data as in
cell A1, i.e. the id number), and the range lookup is TRUE for a close match
and FALSE for an exact match.

Best,

Matthew Herbert
 
G

Gord Dibben

Do you specifically need a macro?

VLOOKUP worksheet function would do as well.


Gord Dibben MS Excel MVP
 
A

amanda

Amanda,

Have you looked at using the VLOOKUP function?  If your data (i.e. the id
number, color, price, and type) is in a table, then simply use VLOOKUP.  So,
you would have a VLOOKUP function in cells B1, C1, and D1.  The lookup value
would reference A1, the table array would be wherever your table data is
located, the column index would correspond to the appropriate table column of
the data you want returned (where column 1 has the same type of data as in
cell A1, i.e. the id number), and the range lookup is TRUE for a close match
and FALSE for an exact match.

Best,

Matthew Herbert







- Show quoted text -

Hi Matthew. This worked great. Thank you very much for your help!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top