Help with creating a function

C

Craig

Hi,

I need help with this function.

=IF(D2="text", "G2","0")

When I copy the formula to the cells below it changes the reference of the
logical test, which is great, but I also need it to change the reference cell
of the true result. So that when I copy it to the cell below it becomes:

=IF(D3="text", "G3","0")

Thanks,

Craig
 
J

JE McGimpsey

Are you trying to return the *value* that is in cel G3, G4, etc?

Then

=IF(D3="text", G3, 0)

If you're trying to return the text strings "G3", "G4", etc., and the
text string "0", then, assuming your formula is in row 3:

=IF(D3="text", "G" & ROW(), "0")

If it's in a different row, add or subtract a value to suit. For
instance, if the formula is in row 2:

=IF(D3="text", "G" & ROW()+1, "0")
 
L

Lars-Åke Aspelin

Hi,

I need help with this function.

=IF(D2="text", "G2","0")

When I copy the formula to the cells below it changes the reference of the
logical test, which is great, but I also need it to change the reference cell
of the true result. So that when I copy it to the cell below it becomes:

=IF(D3="text", "G3","0")

Thanks,

Craig

Try this:

=IF(D2="text","G"&ROW(G2),"0")

Hope this helps / Lars-Åke
 
C

Craig

Thanks, that was very helpful. I removed the quotes around the true result
and removed the quotes in the false result and it updates the function
perfectly. I ended up with this:

=IF(D2="text", G2,"")

Craig
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top