Multiple blanks in my excel file, need a for loop?

I have a list generated from my ERP system as an excel file. It is a list of customers and what city//state/country they are located in. If there are multiple purchases from the same a customer, their name will show up blank for all following transactions after.

Example:
Customer A Chicago IL, USA
Customer B Nashville TN, USA
Nashville TN, USA
Customer C Detroit MI, USA
Detroit MI, USA
Detroit MI, USA
Customer D Atlanta GA, USA

I am trying to use a for loop to fill in the blanks, but I am struggling to get it working. I am attempting a for loop that when it reads a blank cell, it writes the cell above it, but I am struggling with that. Any suggestions?

  • For Each Row in yourDT
    – If NOT String.IsNullOrEmpty(CurrentRow(“Column Name”).ToString.Trim)
    — Then Assign CurrentCustomerName = CurrentRow(“Column Name”).ToString.Trim
    — Else CurrentRow(“Column Name”) = CurrentCustomerName

Basically as you’re looping if the value is not empty stick it in a variable. If the value is empty, overwrite it with what’s in the variable.

Hi @lmanier

Check the below wokflow for better understanding,
Sequence2.xaml (18.0 KB)

Output File - Sheet1 has Input and Sheet2 has Output
expectedoutput.xlsx (10.8 KB)

Hope it helps!!

Thank you for your support, Paul!

Thank you for your assistance, Mahesh!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.