Excel: How to Autofill Cells Based on Value in Another Cell


Often you may want to autofill the cells in Excel based on the value in another cell.

This is simple to do using an IF function and the following example shows how to do so.

Example: How to Autofill Cells Based on Value in Another Cell in Excel

Suppose we have the following column in Excel that shows the position of various basketball players:

Now suppose we would like to autofill the values in column B to contain “Yes” if the value in column A is “Guard” or “No” if the value in column A is any other value.

We can type the following formula into cell B2 to do so:

=IF(A2="Guard", "Yes", "")

We can then click and drag this formula down to each remaining cell in column B:

Excel autofill cell based on value in another cell

Each value in column B is autofilled based on the corresponding value in column A.

For example:

  • Cell A2 contains “Guard” so cell B2 is filled with “Yes”
  • Cell A3 contains “Guard” so cell B3 is filled with “Yes”
  • Cell A4 does not contain “Guard” so cell B4 is left empty

And so on.

Note that we could also create a more complex rule for autofilling if we’d like.

For example, we could type the following formula into cell B2 to autofill “Yes” if the value in cell A2 is Guard or Forward:

=IF(OR(A2="Guard",A2="Forward"),"Yes","")

We can then click and drag this formula down to each remaining cell in column B:

Column B now displays “Yes” if the corresponding cell in column A is equal to Guard or Forward, otherwise it is left blank.

Additional Resources

The following tutorials explain how to perform other common operations in Excel:

How to AutoFill Dates in Excel
How to Autofill Letters of the Alphabet in Excel
How to Autofill Values from Another Sheet in Excel
How to AutoFill Using a Custom List in Excel

Leave a Reply

Your email address will not be published. Required fields are marked *