Hi,
I've been struggling with this problem myself and figured I'd turn to the collective knowledge here for help.
I'm trying to formulate some sentences based on results of a comparison.
I'm comparing my current car's attributes to other cars that I've entered data for. The phrases generated need to describe the differences in positive, negative and equal attributes between the 2 cars.
I know how to concatenate text but this is a little trickier.
For instance if there is only 1 negative "difference" and it's wheelbase, I want it to say "Negative Differences Are 10 inches less wheelbase."
If there are 2 negative "differences" and they are wheelbase and doors, I want it to say "Negative Differences Are 10 inches less wheelbase and 2 less doors." (this inserts an 'and' between the 2 attributes).
If there are 3 negative "differences" and they are wheelbase, doors and warranty miles, I want it to say "Negative Differences Are 10 inches less wheelbase, 2 less doors and 10000 less warranty miles." (inserting a ',' and an 'and' between the attributes).
Repeat above scenarios with Positive and Equal attributes.
Every car compared will obviously have it's own set of differences (positive/negative) and equalities and probably a different number of each.
A big part of the problem is knowing when the final attribute is encountered and whether to insert a comma, an 'and', a period or nothing in the appropriate places to form a proper sentence when differences are described.
All of the math for the differences has been done and the differences are in their respective columns....Negative / Positive / Equal columns.
I know it's hard to describe and that's why I've attached an example spreadsheet with some example data and an expected phrase/sentence I'm trying to generate.
The phrase I'm trying to generate is in cells B11 and B22.
Forgot to mention I'm using Excel 2002 for this.
Thanks for any help!
Whew!
Bookmarks