ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if then clause in a cell (https://www.excelbanter.com/excel-programming/286263-if-then-clause-cell.html)

mikewild2000

if then clause in a cell
 
I believe i need to write a if then clause.

What i am trying to do is pretty simple in access, but in excel - i've
been at it for days.

Cells A3 to A10 always hold data. In cells D3 to D10 only one cell
holds data, which is a number "1", the other cells are null.


What i am trying to do is:
If cell D4 = 1 then fill cell D12 with the value of cell A4, likewise
if cell D7 = 1 then fill cell D12 with the value of cell A7.

How do i do this and where would i pop the code?

Just new to excel - but making good progress.


---
Message posted from http://www.ExcelForum.com/


Rob van Gelder[_4_]

if then clause in a cell
 
In D12:
=INDEX(A3:A10,MATCH(1,D3:D10,0))

"mikewild2000" wrote in message
...
I believe i need to write a if then clause.

What i am trying to do is pretty simple in access, but in excel - i've
been at it for days.

Cells A3 to A10 always hold data. In cells D3 to D10 only one cell
holds data, which is a number "1", the other cells are null.


What i am trying to do is:
If cell D4 = 1 then fill cell D12 with the value of cell A4, likewise
if cell D7 = 1 then fill cell D12 with the value of cell A7.

How do i do this and where would i pop the code?

Just new to excel - but making good progress.


---
Message posted from http://www.ExcelForum.com/




mikewild2000[_3_]

if then clause in a cell
 
Thank you - works a treat!

--
Message posted from http://www.ExcelForum.com


mikewild2000[_11_]

if then clause in a cell
 
Thanks.

How do i get around D12 giving #N/A error. Can it be changed to a "0"
rather than give the error?

The error occurs when there is no value in D3:D10


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 01:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com