View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
[email protected] alanglloyd@aol.com is offline
external usenet poster
 
Posts: 38
Default get a cell reference as a result of an If Function

On Mar 21, 8:24*am, coolistic wrote:
Hello,
*This is more complicated than it sounds. I need to do an If function to get a
*cell reference as a result... Let me give you my situation....

*I have an if function that should go like this...

*Pretend I am typing this function into cell B1:

*"If cell C1 is less than or equal to zero, then reference cell A1, if not
*then add 1 to that to reference cell A2 instead."

*That way cell B1 will either be referencing cell A1 or A2. But I need this to
be
*in such a way that I can copy this function down hundreds of cells in the B
*column so that it will always continue to reference down the line to A3 then
A4,
*then A5... etc.... but it will only change when the cell in C column is
*positive.


If you mean that B1 will reference A1 or A2 depending on sign of C1
then B1 is

=IF(C10, A2, A1)

and drag the copy square down and B4 will be

=IF(C40,A5,A4)

OTOH if you mean that B4 should be =IF(C10,A5,A4) then having put the
same formula into B1, then click on the formula to position the cursor
between the C & 1, and press F4 once. The formula will then show B1 is

=IF($C$10, A2, A1)

Which means that the C & the 1 will not change as you copy-drag the
square down.

Pressing F4 repeatedly will change the formula to C$1, $C1, $C$1 and
then C1. In each case the dollar sign indicates that that part of the
formula will not change as you copy it.

But if you want something else then explain less ambiguously <g.

Alan Lloyd