0

I am trying to figure out how best to automate a "lookup" process of sorts (really it's more so just an attempt to copy and paste a specific value) over this strange document format I am working with. It looks as follows:

IMG:

So what I am trying to do is to get the product code from column D (e.g. D2) which is associated with buyers from the rows directly below (e.g. C3 and C4) which is 1,,,x buyers (so the amount of buyers is not a constant) and then fill the value in front of said buyers (column B e.g. B3 and B4) with the respective product code. I haven't used VBA before (although I am fairly familiar with python) so I imagine there could be a solution that is related to that, but I can't seem to find any way to do it without using some form of more "advanced" coding than basic excel formulae inside cells would allow. Wondering if anyone could help me figure our what I should do.

NOTE - in columns E and beyond there will be data in regard to how much of a product that a given buyer has purchased. Not sure if this is relevant, but maybe it gives more insight as to what I am trying to do.

1 Answer 1

0

If the pattern is always the same, meaning that there is a blank cell between the buyers of various product codes then you can try the following formula on column B:

=IF(AND(B2="",D2<>""),D2,"")

Drag it down to fill the other cells. The formula checks if the cell above is empty and if the respective cell in column D is not empty. If it is true/yes, then copy the value from column D to cell on the row below in column B.

enter image description here

1
  • Thank you so much! It actually ended up being a bit more complicated, but in the end I managed to get it done with about three nested if statements (i.e. IFS). I wouldn't have figured it out without you leading me in the right direction. Thank you so much!
    – KLonge
    Commented Jul 20, 2020 at 16:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .