String Manipulation with VBA

As a performance tester, most data arrives at me in a spreadsheet, or an enormous text file with little or no delimitation.

The previous article showed how to parse across columns and down rows to gather data.

Excel has a number of built in functions to manipulate that data before outputting it for us.

Functions like

MID To pull a child string from a parent string specificied by the number and position of characters
LEFT / RIGHT Similar to mid, but from either the 1st or Last character in the string
TRIM Removes whitespace from the ends of strings (both ends)

These help immeasurably in cleaning up the data.

Tied into further functions like

We have the facility to parse through raw data, picking up the elements we need and outputting them in the form we require. Given that loadrunner uses .dat or .csv files for test data input, this is hugely useful.

Instr is specifically used within VBA, the other functions mentioned can also be used at the worksheet level and embedded into formulae.

Instr Search inside one string for another
You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress and ThemeMag