Home » excel » vba – Insert row with data into excel sheet from another sheet dynamically

vba – Insert row with data into excel sheet from another sheet dynamically

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have two different excel sheet first sheet contain some country list and second sheet is blank. There is a dropdown column with every country which contain ‘Yes’ ‘No’. When I select yes I want that, the selected country row will automatically add to second sheet with all data. When I select more country they will dynamically insert/add to second sheet with maintaining country order in the first sheet.
Excel dynamic row insert These can be done with macro but I want to do this with formula.

How to&Answers:

Try this:

=IFERROR(INDEX(Sheet1!$A$1:$C$7,SMALL(IF(Sheet1!$D$1:$D$7="Yes",ROW(Sheet1!$D$1:$D$7),1E+99),ROW($A1)),COLUMN(A$1)),"")

Input formula in Cell A2 of Sheet2 and press Ctrl+Shift+Enter.
Then copy to remaining cells. Adjust the addresses in the formula to suit. HTH

Result:

enter image description here