Writing scripts

S

Steve Grosz

Where can I find info on writing scripts for Excel. What I am trying to
do is this. I have a .CVS file that is always in the same format. In 1
of the colums there are standard phrases that come from the our
database. What I'd like to do is take those phrases and use something
like a 'case' command to compare that statement to a list and then based
on the list, insert the correct action into the same field as the
standard phrase.

It would have to loop through all the rows, and those numbers can vary
quite a bit......

Can anyone help me on the best way to handle this?

Thanks!
Steve
 
P

Pete_UK

Can you give some examples of what your "standard phrases" are, what
your "list" might look like, and what type of thing you mean by
"correct action"? If you keep your comments this vague you can't expect
a lot of help!

Pete
 
S

Steve G

Ok, some of the phrases might be along the lines of "unable to contact IP",
or "No collection from device"

The 'correct action' would be the result of comparing the above phrase
against the list of phrases, like the ones above, and so, if the 'unable to
contact IP' is encountered, the correct action would be to 'verify IP'.

The hard part is that 2-3 phrases ("unable to contact IP"), etc, may have
the same result - "verify IP".

The list has a location, company info, etc, and this phrase being the last
item on the row. On the next row down, the information is exactly the same.

Thanks,
Steve
 
P

Pete_UK

All you need to do is build up a table of two columns - in the first
column you should record your standard phrases (they must be *exactly*
as you would expect them, no trailing spaces etc.) and in the second
column you would record the relevant actions. Let's suppose there are
50 of these, and that you set up your table to occupy cells X1 to Y50.

Assume that your standard phrases in the imported data occupy column F,
starting at F2 to allow for a heading row. In a spare column, let's say
M, you could enter this formula in M2:

=VLOOKUP(F2,$X$1:$Y$50,2,0)

This should give you the appropriate action to the phrase in F2. If you
have, say, 600 rows of data, you should copy M2 all the way down to
M600.

Hope this helps.

Pete
 
Top