Copy and Duplicate cells from based on column value from 1 sheet to another sheet

Copper Contributor

Hello All,

I want to copy the values of 2 columns based on a value in a 3rd column. The values should be duplicated based on the value in the 3rd column. The input data and output data are in different sheets. Please see the pictures below. What could be done to automate this process. A VBA Code perhaps?

 

Thanks

Input_Output.png

3 Replies

@AShah16 Consider Power Query (PQ) to do this. Demonstrated in the attached file. The green table is the table loaded by PQ. In this example I loaded it in the same sheet as the blue table but you can load it to another sheet as well.

 

Riny_van_Eekelen_0-1644311507928.png

 

Hello @Riny_van_Eekelen,
Thanks for your kind reply. In my case the number of Bins may change based on the user input. If the bins change i will probably need to refresh the query to update the output table. I was wondering if there is a way that as the user updates the Bins the output table is updated instantly and automatically.

Thanks a lot again.

@AShah16 You can write a piece of VBA code that will refresh the query as soon as something in the sheet changes. But VBA isn't my area of expertise. Sorry.