How would I go about copying a value from a cell given certain conditions?

vbaNumpty

Board Regular
Joined
Apr 20, 2021
Messages
171
Office Version
  1. 365
Platform
  1. Windows
I have a table with a customer and a bunch of line items tied to the customer, and then the next customer and a bunch of line items. Due to the way the information is received there are blank values between customers. I Have

CUSTOMERPRODUCTQTY
Customer AABC20
XYZ5
LMN15
Customer BABC5
DEF50
GHI10

What this is saying is the first three rows are attributed to Customer A and the following three to Customer B

I am trying to get PQ to total the different products and their permutations but I need to assign line items to the customer names.

I am trying to get PQ to check where to put Customer A or B with the following logic:
For each blank cell in the customer column check if there is a value one row above and one column to the right, if those two conditions are met put the value of the row above in the empty cell. So the column immediately below Customer A would see XYZ to the right of it and Customer A above it and populate with Customer A. Then it would continue down each row and perform the same function.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Turns out there is a very useful tool called fill down that can be used to do the exact thing I was looking for!
 
Upvote 0
Solution

Forum statistics

Threads
1,215,772
Messages
6,126,814
Members
449,339
Latest member
Cap N

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top