I've got a funky situation here that I think a script could solve, but I'm no good at scripting Excel, so there!
It's Excel 2007 btw.
My online store exports a CSV of orders along with the line items of the order. To accomplish this, it outputs one row as the customer, having name, order #, etc etc. Then it spits out consecutive rows where those fields are left blank, but the item fields are filled in. Looks something like this for example:
fname,lname,ordernum,productname,qty
jack,wilson,12345,,
,,,widget1,1
,,,widget2,1
,,,widget3,4
bill,smith,39289,,
,,,widget1,3
,,,widget2,1
Etc...
It actually looks alright in Excel, as the list of products sits nicely under the customer "row".
My problem is this, I've got thousands of rows, I'm looking for all the customers that have bought widget2 to get their name and Email so we can update them on the product.
I can't simply search for "widget2" and grab the row above, cause the row above might be another line item or whatever. So somehow I have to search for the widget2, then offset left and see if it's blank, if it is blank, then offset UP until it finds text (which would be the Email or name field). Once it finds the text, I need THAT row copied out onto another sheet to build the Email list with.
Does that sound convoluted? I'm not sure how else to do this but Excel scripting may be the only way to go, if someone can help program the logic of the search and row-finding that would be awesome.
Ideas?