If the cell contains the same NUMBER in Excel Help

If the numbers are the same in Excel, I want to input values for Description, DEI, Size, Box/PLT count, DI, and BI into the same Excel sheet.
I’ve thought about it, but couldn’t find an answer, so I wanted to ask a question.
I provided a more detailed explanation with an image.
Thank you in advance for the response.

Hi, for this you can use linq, using group inside the linq.

1 Like

Hi @22222222asas ,

Can u elobrate bit more on the ask ??

1 Like

@fernan
Hello, thank you for your response. My skills are still lacking
Could you explain with images or code?

@AutomationX_by_Kiran

Hello, thank you for your response. I’ll explain again using an image.

In an Excel file titled ‘Parking,’ when there are identical numbers in the ‘Number’ cell, I only paste the ‘Number’ once in the Excel named ‘Pick.’ Additionally, I input data for ‘Description,’ ‘DEI,’ ‘Size,’ ‘Box/PLT count,’ ‘DI,’ ‘BI,’ and other fields.

Next, for the number 705250, since there are no duplicates, I enter the data one by one. Similarly, for the number 245625, since there are no duplicates, I enter the data one by one. Finally, for the number 30000, as there are duplicates, I enter the number 30000 in the ‘Number’ only once, just like number 80000, and input the rest of the data. A new Excel file is created for each unique number.

If my explanation is unclear, please feel free to ask again! Thank you!

I understand here you have 2 files,
Will the positions of those columns change?
regards,

1 Like

@Nguyen_Van_Luong1
Hello, thank you for your response. The column positions are always fixed!

Does the number of cells change?
If they are also fixed, I will create a similar file
regards,

1 Like

@Nguyen_Van_Luong1
Hello, thank you for your response. The number of cells is also always fixed!

Could you please share to me sample file? (if private you can send in message) or I will create the same
regards,

1 Like

@Nguyen_Van_Luong1
Hello, thank you for your response. I have attached the data here. Please note that the number of identical values in the ‘number’ is random and may or may not be present. Thank you!

parking.xlsx (10.8 KB)
pick.xlsx (17.9 KB)

1 Like

@22222222asas

Follow the steps

  1. Read the excel data into datatable dt
  2. Now use assign with distinctdt = dt.DefaultView.ToTable(True,"Number") , this will give you all didtinct values in column 1 in separate table
  3. Now use for each row in datatable on distinctdt
  4. Inside the loop use filter datatable and input is dt and output is filtereddt and filter on column "Number" with currentRow(0)
  5. Now you have only the data which is similar in filtereddt use a for each row in dattable on filtereddt and insert data as you need using write cell activities…as you need to fill number only once fill the number before for each only using write cell with giving the constant cell number. And inside loop for write cell use auto increment so that the cell value changes always

Please try out the same

Cheers

1 Like

Hi @22222222asas ,
my input


→ I have edited file pick.xlsx to blank and keep header only
my output

my source
excel number.zip (71.8 KB)

regards,

1 Like

@Nguyen_Van_Luong1

Thank you for the response!!! When I tried to proceed with the code, I encountered an error saying ‘If: Object reference not set to an instance of an object.’ Could you please let me know what needs to be modified in this part?

image

Did you edit anything?
I’m still running fine now
excel number.zip (71.8 KB)

regards,

1 Like

@Nguyen_Van_Luong1

Thank you for your response! However, it seems that there is an error when deleting data in the “pick” Excel, which is an Excel for data entry. How can I fix this issue?

image

I have blanked it out for the robot to import after comparing it with the parking.xlsx file
You can use the old file, I put it in the backupfile folder
regards,

1 Like

@Nguyen_Van_Luong1
Hmm… I’m having trouble understanding, so may I ask questions through messages since my skills are not sufficient for comprehension?

@Anil_G
Hello, thank you for your response! Could you please explain the code with images if possible?

OK, let’s ask me if you have