How to Copy Cell If Condition Is Met in Excel (7 Easy Ways)

The sample dataset contains Product, Salesman, and Net Sales information. There are 2 types of products available. We’ll show how to copy the rows based on the cells inside them.

copy cell if condition is met excel


Method 1 – Apply the Filter Feature to Copy a Cell If Condition Is Met in Excel

Steps:

  • Click on cell C4, which is the Product header.
  • Go to Home, select Sort & Filter, and choose Filter.

Apply Filter Feature to Copy Cell If Condition Is Met in Excel

  • Click the drop-down icon beside Product.
  • Check the box for AC as we want rows with AC.
  • Press OK.

  • This’ll return the required rows.
  • Select and copy the range by pressing Ctrl + C.
  • You can paste the values wherever you want by pressing Ctrl + V.


Method 2 – Copy Cell by Using the FILTER Function

Steps:

  • Select cell B12.
  • Insert this formula:
=FILTER(B5:D10,C5:C10=C5)
  • Press Enter.
  • This will spill the rows that have cells with desired conditions.
  • We can perform this task where we want to paste, or we can copy the following results and paste them there.

Copy Cell by Using Excel FILTER Function


Method 3 – Insert the IF Function for Copying Cell with Condition=

Steps:

  • Click on cell B12.
  • Insert the formula:
=IF($C5="AC",B5,"")
  • Hit Enter.
  • Apply AutoFill to complete the column.
  • You can copy and paste the values where you want.

Insert IF Function for Copying Cell with Condition


Method 4 – Copy a Cell by Using the Find Command in Excel

Steps:

  • Select the cell range B5:D10.
  • Press Ctr + F to open the Find and Replace dialog box.
  • Type AC in Find what and click Find All.

Copy Cell by Using Find Command in Excel

  • Select all the cells.

  • Close the dialog box.
  • You’ll see the cells are selected in the dataset.
  • You can copy the desired cells.

Read More: How to Copy Multiple Cells to Another Sheet in Excel


Method 5 – Input the SWITCH Function to Copy a Cell If the Condition Is Met

Steps:

  • Choose cell B12.
  • Insert the formula:
=SWITCH(TRUE,$D5>10000,B5,"")
  • Click Enter.
  • Use AutoFill to fill the series.
  • This formula checks if the D column values are greater than 10,000. It’ll return blank for the rows where the D column cells do not meet the condition.
  • You can input this formula where you want to paste the data.

Input SWITCH Function to Copy Cell If Condition Is Met


Method 6 – Combine CHOOSE and MATCH Functions for Copying Cells

Steps:

  • Select cell B12.
  • Insert the following formula:
=CHOOSE(MATCH($C5,$C$5:$C$10,0),B5,"")
  • Press Enter and apply AutoFill.
  • The MATCH function looks for AC and returns the cell location. The CHOOSE function gives out the B5 cell value as this row contains AC.
  • You can now copy the cells that satisfy the conditions.

Combine CHOOSE and MATCH Functions for Copying Cell


Method 7 – Run Excel VBA to Copy Cells If the Condition Is Met

Steps:

  • Select Developer and choose Visual Basic.

Run Excel VBA to Copy Cell If Condition Is Met

  • The VBA window will appear.
  • Click on Insert and select Module.
  • Copy the below code and paste it there.
Sub Solution_For_Loop()
Input_Sheet = "VBA"
Input_Range = "B5:D10"
Criteria_Column = 3 'Net Sales is in column 3 of the range B5:D10.
Output_Sheet = "Paste"
Output_Cell = "B2" 'The output range will start from cell B2.
Set Rng1 = Worksheets(Input_Sheet).Range(Input_Range)
Set Rng2 = Worksheets(Output_Sheet).Range(Output_Cell)
Count = 1
For i = 1 To Rng1.Rows.Count
    If Rng1.Cells(i, Criteria_Column) > 10000 Then
        For j = 1 To Rng1.Columns.Count
            Rng2.Cells(Count, j) = Rng1.Cells(i, j)
        Next j
        Count = Count + 1
    End If
Next i
End Sub 
			

  • Save the file and press F5 to run the code.
  • This will return the rows with net sales greater than 10,000 in the Paste sheet.
  • See the following picture for the outcome.


Copy the Cell Value to Another Cell in Excel Automatically

Steps:

  • Select cell B12.
  • Use the formula:
=B5
  • Press Enter.
  • This will return the B5 cell’s value and keep them linked.

Copy Cell Value to Another Cell in Excel Automatically


Download the Practice Workbook


Related Articles


<< Go Back to Copy a Cell | Copy Paste in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Aung Shine
Aung Shine

Aung Shine completed his bachelor’s in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. It has been almost 2 years since he joined SOFTEKO and actively working on the ExcelDemy project. Currently he works as a Team Leader where he guides his team members to create technical content. He has published 150+ articles and reviewed 50+ articles. He has also solved various user problems before. He has interests in Data Analysis, Power Query, Advanced Excel,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo