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

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3135296%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3ECopy%20and%20Duplicate%20cells%20from%20based%20on%20column%20value%20from%201%20sheet%20to%20another%20sheet%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3135296%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EHello%20All%2C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI%20want%20to%20copy%20the%20values%20of%202%20columns%20based%20on%20a%20value%20in%20a%203rd%20column.%20The%20values%20should%20be%20duplicated%20based%20on%20the%20value%20in%20the%203rd%20column.%20The%20input%20data%20and%20output%20data%20are%20in%20different%20sheets.%20Please%20see%20the%20pictures%20below.%20What%20could%20be%20done%20to%20automate%20this%20process.%20A%20VBA%20Code%20perhaps%3F%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EThanks%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%5C%26quot%3Blia-inline-image-display-wrapper%22%20lia-image-align-inline%3D%22%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fgxcuf89792%2F%5C%26quot%3Bhttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F346151iE3C6FF91AFF184D0%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%5C%26quot%3B%22%20role%3D%22%5C%26quot%3Bbutton%5C%26quot%3B%22%20title%3D%22Input_Output.png%22%20alt%3D%22%5C%26quot%3BInput_Output.png%5C%26quot%3B%22%20%2F%3E%26lt%3B%5C%2Fspan%26gt%3B%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3CLINGO-LABS%20id%3D%22%5C%26quot%3Blingo-labs-3135296%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CLINGO-LABEL%3EExcel%26lt%3B%5C%2Flingo-label%26gt%3B%3CLINGO-LABEL%3EMacros%20and%20VBA%26lt%3B%5C%2Flingo-label%26gt%3B%26lt%3B%5C%2Flingo-labs%26gt%3B%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E
Occasional 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.