cancel
Showing results for 
Search instead for 
Did you mean: 

MS Excel VBO

NikitaSatpathy
Level 3

My requirement is to read and excel and write only the filtered data based on a condition to another sheet in the same excel.

For example- If Column A = "A particular value", then just write that entire row into another sheet having that column value.

12525.png

Like if Supplier = "Nutricia" , only write that row into another sheet and ignore rest of the rows.



------------------------------
Nikita Satpathy
------------------------------
16 REPLIES 16

Hi Nikita,

Good Day!

Please be mindful of using single quotes and double quotes. So the value of the attribute which you want to filter should be in single quotes and the whole filter expression should be in double quotes. And also the spaces needs to be removed 
So here in this case it would like (refer to the screenshot as well)
"[Supplier]='Nutricia'"

12437.png



------------------------------
Susamay Halder Consultant
Consultant
Bruce Power
+1(437)217-1086
------------------------------

Dear Nikita,

Please try this expression "[Supplier]='Nutricia'" hopefully it will work.

Also please try to validate the expression to make sure that you will not encounter any error. 



------------------------------
SYED FAHEEM
RPA Developer
Arab Financial Services
Manama
------------------------------

Hi Susamay,

I tried this exact expression and there was no error.

But the condition did not work and the entire data of first sheet got copied into the new sheet. This was my issue since the beginning

Check the attachment, "Export" sheet is the initial sheet and "Export Result" is my new sheet where i wanted to have only the row having Supplier = "Nutricia" from the first sheet.



------------------------------
Nikita Satpathy
------------------------------

Dear Nikita,

Could you please try this expression "[Supplier] Like '%Nutricia%'".



------------------------------
SYED FAHEEM
RPA Developer
Arab Financial Services
Manama
------------------------------

Hi Syed,

I tried the expression,still the same, all the rows are getting copied in the new sheet

12488.png



------------------------------
Nikita Satpathy
------------------------------

Hi Nikita,
Please find the attached solution. In the sales by supplier file the bot would make a separate worksheet with Nutirica Data only. These were the below steps performed. Screenshot attached as well
12503.png
1. Get the data to a collection 

2. Filter the collection NOT directly from the excel sheet 

3. Write the filtered collection in a new sheet.
Its working good
The process and the source file is attached. Can you please import it and try running it?
If this solution solves the problem  the please vote the answer as best solution. 



------------------------------
Susamay Halder Consultant
Consultant
Bruce Power
+1(437)217-1086
------------------------------

Dear Nikita,

Please make sure that you're writing the filtered collection data into the excel using Write collection in MS Excel VBO.

if possible, create a new sheet and write data in newly created Sheet.



------------------------------
SYED FAHEEM
RPA Developer
Arab Financial Services
Manama
------------------------------