Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nelson
 
Posts: n/a
Default add to an existing function

Hello,

I need to add an if statement to existing cells that already contain
formulas. For example, the cells contain a =vlookup(...) statement, but
because I'm getting some #n/a, I need to add an if statement such as
=if(iserror(vlookup(...)),"No Data", vlookup(...)) to all the cells. The
problem is that I have over 5000 cells with formulas in it, and I just need
to add the if statement!

Is there a way to do this instead of having to go into every single cell and
re-enter the additional statements?

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default add to an existing function

Hi

An example

In Cell C2 you have a formula
=IF(ISERROR(VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))," No
Data",VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))

When you copy C2 down, then in C3 the formula will search for value equal to
one in A3, in C4 for value equal yo one in A4, etc, in range
Sheet1!$A$2:$X$100. I.e you edit the formula in one cell, and copy it to
other cells in same column.

The character $ (or absence of it) determines refernce type, i.e. how the
reference behaves when copied. With $ the reference is absolute, without it
relative. There are 4 possible variations
$C$R - the reference remains same when copied
C$R - the row reference reamains same, column reference changes
$CR - the row reference changes, column reference reamains same
CR - both row and column references change.

Arvi Laanemets


"Nelson" wrote in message
...
Hello,

I need to add an if statement to existing cells that already contain
formulas. For example, the cells contain a =vlookup(...) statement, but
because I'm getting some #n/a, I need to add an if statement such as
=if(iserror(vlookup(...)),"No Data", vlookup(...)) to all the cells. The
problem is that I have over 5000 cells with formulas in it, and I just

need
to add the if statement!

Is there a way to do this instead of having to go into every single cell

and
re-enter the additional statements?

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nelson
 
Posts: n/a
Default add to an existing function

Hi Arvi,

Thanks for the reply. I was not specific in my previous message. I don't
have the same vlookup in all the cells, so I cannot simply drag the cell that
I changed to the adjacent cells. I have vlookups in cells but doing
different things. All I need is to add an if statement so that when I get
#n/a, I will have text instead of the error.

"Arvi Laanemets" wrote:

Hi

An example

In Cell C2 you have a formula
=IF(ISERROR(VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))," No
Data",VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))

When you copy C2 down, then in C3 the formula will search for value equal to
one in A3, in C4 for value equal yo one in A4, etc, in range
Sheet1!$A$2:$X$100. I.e you edit the formula in one cell, and copy it to
other cells in same column.

The character $ (or absence of it) determines refernce type, i.e. how the
reference behaves when copied. With $ the reference is absolute, without it
relative. There are 4 possible variations
$C$R - the reference remains same when copied
C$R - the row reference reamains same, column reference changes
$CR - the row reference changes, column reference reamains same
CR - both row and column references change.

Arvi Laanemets


"Nelson" wrote in message
...
Hello,

I need to add an if statement to existing cells that already contain
formulas. For example, the cells contain a =vlookup(...) statement, but
because I'm getting some #n/a, I need to add an if statement such as
=if(iserror(vlookup(...)),"No Data", vlookup(...)) to all the cells. The
problem is that I have over 5000 cells with formulas in it, and I just

need
to add the if statement!

Is there a way to do this instead of having to go into every single cell

and
re-enter the additional statements?

Thanks in advance




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
 
Posts: n/a
Default add to an existing function

Nelson

Sub NATrapAdd()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=IF(ISNA*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=IF(ISNA(" & myStr & "),""""," & myStr & ")"
'for text, change """" to "text message"
End If
End If
Next
End Sub


Gord Dibben Excel MVP

On Wed, 7 Dec 2005 12:20:01 -0800, Nelson
wrote:

Hi Arvi,

Thanks for the reply. I was not specific in my previous message. I don't
have the same vlookup in all the cells, so I cannot simply drag the cell that
I changed to the adjacent cells. I have vlookups in cells but doing
different things. All I need is to add an if statement so that when I get
#n/a, I will have text instead of the error.

"Arvi Laanemets" wrote:

Hi

An example

In Cell C2 you have a formula
=IF(ISERROR(VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))," No
Data",VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))

When you copy C2 down, then in C3 the formula will search for value equal to
one in A3, in C4 for value equal yo one in A4, etc, in range
Sheet1!$A$2:$X$100. I.e you edit the formula in one cell, and copy it to
other cells in same column.

The character $ (or absence of it) determines refernce type, i.e. how the
reference behaves when copied. With $ the reference is absolute, without it
relative. There are 4 possible variations
$C$R - the reference remains same when copied
C$R - the row reference reamains same, column reference changes
$CR - the row reference changes, column reference reamains same
CR - both row and column references change.

Arvi Laanemets


"Nelson" wrote in message
...
Hello,

I need to add an if statement to existing cells that already contain
formulas. For example, the cells contain a =vlookup(...) statement, but
because I'm getting some #n/a, I need to add an if statement such as
=if(iserror(vlookup(...)),"No Data", vlookup(...)) to all the cells. The
problem is that I have over 5000 cells with formulas in it, and I just

need
to add the if statement!

Is there a way to do this instead of having to go into every single cell

and
re-enter the additional statements?

Thanks in advance




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nelson
 
Posts: n/a
Default add to an existing function

Thank you...it was what I was looking for!

"Gord Dibben" wrote:

Nelson

Sub NATrapAdd()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=IF(ISNA*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=IF(ISNA(" & myStr & "),""""," & myStr & ")"
'for text, change """" to "text message"
End If
End If
Next
End Sub


Gord Dibben Excel MVP

On Wed, 7 Dec 2005 12:20:01 -0800, Nelson
wrote:

Hi Arvi,

Thanks for the reply. I was not specific in my previous message. I don't
have the same vlookup in all the cells, so I cannot simply drag the cell that
I changed to the adjacent cells. I have vlookups in cells but doing
different things. All I need is to add an if statement so that when I get
#n/a, I will have text instead of the error.

"Arvi Laanemets" wrote:

Hi

An example

In Cell C2 you have a formula
=IF(ISERROR(VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))," No
Data",VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))

When you copy C2 down, then in C3 the formula will search for value equal to
one in A3, in C4 for value equal yo one in A4, etc, in range
Sheet1!$A$2:$X$100. I.e you edit the formula in one cell, and copy it to
other cells in same column.

The character $ (or absence of it) determines refernce type, i.e. how the
reference behaves when copied. With $ the reference is absolute, without it
relative. There are 4 possible variations
$C$R - the reference remains same when copied
C$R - the row reference reamains same, column reference changes
$CR - the row reference changes, column reference reamains same
CR - both row and column references change.

Arvi Laanemets


"Nelson" wrote in message
...
Hello,

I need to add an if statement to existing cells that already contain
formulas. For example, the cells contain a =vlookup(...) statement, but
because I'm getting some #n/a, I need to add an if statement such as
=if(iserror(vlookup(...)),"No Data", vlookup(...)) to all the cells. The
problem is that I have over 5000 cells with formulas in it, and I just
need
to add the if statement!

Is there a way to do this instead of having to go into every single cell
and
re-enter the additional statements?

Thanks in advance






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
 
Posts: n/a
Default add to an existing function

Thanks for the feedback.

Gord

On Wed, 7 Dec 2005 14:06:03 -0800, Nelson
wrote:

Thank you...it was what I was looking for!

"Gord Dibben" wrote:

Nelson

Sub NATrapAdd()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=IF(ISNA*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=IF(ISNA(" & myStr & "),""""," & myStr & ")"
'for text, change """" to "text message"
End If
End If
Next
End Sub


Gord Dibben Excel MVP

On Wed, 7 Dec 2005 12:20:01 -0800, Nelson
wrote:

Hi Arvi,

Thanks for the reply. I was not specific in my previous message. I don't
have the same vlookup in all the cells, so I cannot simply drag the cell that
I changed to the adjacent cells. I have vlookups in cells but doing
different things. All I need is to add an if statement so that when I get
#n/a, I will have text instead of the error.

"Arvi Laanemets" wrote:

Hi

An example

In Cell C2 you have a formula
=IF(ISERROR(VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))," No
Data",VLOOKUP($A2,Sheet1!$A$2:$X$100,6,0))

When you copy C2 down, then in C3 the formula will search for value equal to
one in A3, in C4 for value equal yo one in A4, etc, in range
Sheet1!$A$2:$X$100. I.e you edit the formula in one cell, and copy it to
other cells in same column.

The character $ (or absence of it) determines refernce type, i.e. how the
reference behaves when copied. With $ the reference is absolute, without it
relative. There are 4 possible variations
$C$R - the reference remains same when copied
C$R - the row reference reamains same, column reference changes
$CR - the row reference changes, column reference reamains same
CR - both row and column references change.

Arvi Laanemets


"Nelson" wrote in message
...
Hello,

I need to add an if statement to existing cells that already contain
formulas. For example, the cells contain a =vlookup(...) statement, but
because I'm getting some #n/a, I need to add an if statement such as
=if(iserror(vlookup(...)),"No Data", vlookup(...)) to all the cells. The
problem is that I have over 5000 cells with formulas in it, and I just
need
to add the if statement!

Is there a way to do this instead of having to go into every single cell
and
re-enter the additional statements?

Thanks in advance




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
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
copying existing function Brad Excel Worksheet Functions 0 February 22nd 05 01:34 PM
Formula to list unique values JaneC Excel Worksheet Functions 4 December 10th 04 12:25 AM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


All times are GMT +1. The time now is 03:31 PM.

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"