# How to auto populate with conditions?

It is difficult to explain what I am looking to do so bear with me, I am trying to create a workbook and I want a specific cell to auto-populate.

I used the `IF` function because I want the box to populate with information from another field if a condition is met.

For example... I have 3 cells, I want cell C to populate with information provided in cell B but only when cell A is "XYZ" I would assume the function I should use is: `=IF(CellA="XYZ","CellB",0)`.

The problem is I cannot use another cell as the "value".

• OMG, I can't believe it was so easy, i feel silly! Thank you!! Nov 2, 2017 at 17:59

In a function, you need to use proper cell references. Excel does not recognize "CellB". Proper reference is to use the column and row. For instance, `A1` is the reference for Column A, Row 1.

That being said, your formula in `C1` should be `=IF(A1="XYZ", B1, 0)`. This will return the value of `B1` if `A1` has `XYZ` in it. Otherwise, it will return `0`.

You MAY use another cell as the "value", but without quotes (`"`), e. g.

``````=IF(A1="XYZ", B1, 0)
``````

Then every time when `B1` will change (and `A1` will contain the value `"XYZ"`) the the cell with that formula will show the same value as `B1`.

• If a blank cell is desired when the condition is NOT met (instead of 0) the 0 in the formula can be changed to “” Nov 2, 2017 at 17:57

For Company "XYZ", rent is say Rs.165 per square feet.While for others it is Rs.5000, say.

In column A : Company Name In Column B : Area used in Square Feet In Column C : If Company is "XYZ" then rent in Column C would be Area X 165 else Rs.5000.

So in Column C, Cell C2 Formula would be :

C2= if(A2="XYZ",B2*165,5000)

Copy the formula in C2 and paste it down the column.

If any query, please revert back.

Thanks.