Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 208
Default Help with creating a function

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


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Help with creating a function

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")


In article ,
Craig wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Help with creating a function

You haven't given a reference cell of the true result, you have given a text
string "G2".
If you wish G2 to be a cell reference, it doesn't have quotes around it. In
that case it will happily update as you copy to the row below.
Similarly, if you want the alternative result to be number zero, rather than
a text string, you don't want the quotes round that either.
--
David Biddulph

Craig wrote:
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



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default Help with creating a function

On Mon, 2 Feb 2009 13:23:01 -0800, Craig
wrote:

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
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 208
Default Help with creating a function

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

"David Biddulph" wrote:

You haven't given a reference cell of the true result, you have given a text
string "G2".
If you wish G2 to be a cell reference, it doesn't have quotes around it. In
that case it will happily update as you copy to the row below.
Similarly, if you want the alternative result to be number zero, rather than
a text string, you don't want the quotes round that either.
--
David Biddulph

Craig wrote:
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help creating a function chrspty Excel Worksheet Functions 2 August 1st 08 04:48 PM
Creating a Function Stu Gnu[_2_] Excel Worksheet Functions 2 August 30th 07 11:47 AM
Creating a function BeginnerRick Excel Worksheet Functions 3 November 24th 06 09:12 PM
Need help creating a function nander Excel Discussion (Misc queries) 3 February 20th 06 04:57 AM
creating a function NeilPoehlmann Excel Discussion (Misc queries) 5 June 15th 05 08:08 PM


All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"