Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default Referencing another field if result is N/A

Hello,

I have a situation where I am referencing data on another workbook. The
reason behind this is the data in Column H can be entered incorrectly and
often is. I am able to prevent this going forward but can not do so for the
items already entered. I enter a formula via VBA, however, sometimes the
result will be #N/A and if so I would prefer to leave the old value and just
highlight it that it needs to be verified by hand.

I am not sure if I can just "leave" the value as it has pretty much already
been replaced. Due to this, I copy the column to a different column and what
I hope to do is copy back the same row from column Z back to H if #N/A... I
have tried to write this 50 different ways but for some reason I am having
major problems. This is how I enter the formula and copy the pre formula
value to Z... Any help will be greatly appreciated!

With Workbooks("P-Score and Q-Score trends.xlsx").Worksheets("FO Ref List")
Columns("H").Copy
Range("Z1").PasteSpecial
With .Range("G5", .Range("G5").End(xlDown)).Offset(, 1)
.FormulaR1C1 = "=INDEX('[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C21,MATCH(RC7,'[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C26,0))%26"", ""%26INDEX('[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C20,MATCH(RC7,'[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C26,0))"
.Value = .Value
End With
End With

Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Referencing another field if result is N/A

Brian,

Put the values into column Z, then get a formula to work of the form

=IF(ISNA( Current Formula ), Z5, Current Formula)

Once the formula works, use the macro recorder to record entering the
formula in the cells to get the correct VBA code.

HTH,
Bernie
MS Excel MVP


"Brian" wrote in message
...
Hello,

I have a situation where I am referencing data on another workbook. The
reason behind this is the data in Column H can be entered incorrectly and
often is. I am able to prevent this going forward but can not do so for
the
items already entered. I enter a formula via VBA, however, sometimes the
result will be #N/A and if so I would prefer to leave the old value and
just
highlight it that it needs to be verified by hand.

I am not sure if I can just "leave" the value as it has pretty much
already
been replaced. Due to this, I copy the column to a different column and
what
I hope to do is copy back the same row from column Z back to H if #N/A...
I
have tried to write this 50 different ways but for some reason I am having
major problems. This is how I enter the formula and copy the pre formula
value to Z... Any help will be greatly appreciated!

With Workbooks("P-Score and Q-Score trends.xlsx").Worksheets("FO Ref
List")
Columns("H").Copy
Range("Z1").PasteSpecial
With .Range("G5", .Range("G5").End(xlDown)).Offset(, 1)
.FormulaR1C1 = "=INDEX('[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C21,MATCH(RC7,'[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C26,0))%26"", ""%26INDEX('[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C20,MATCH(RC7,'[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C26,0))"
.Value = .Value
End With
End With

Thank you!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default Referencing another field if result is N/A

I was actually coming here to say I figured it out earlier today lol I ended
up going with IFERROR and it works so I don't hink I will change that around
again lol.

=IFERROR(INDEX('[March 2010 ADIM 1047
report.xls]ADIMR1047'!C21,MATCH(RC7,'[March 2010 ADIM 1047
report.xls]ADIMR1047'!C26,0))&"", ""&INDEX('[March 2010 ADIM 1047
report.xls]ADIMR1047'!C20,MATCH(RC7,'[March 2010 ADIM 1047
report.xls]ADIMR1047'!C26,0)),RC26)"

"Bernie Deitrick" wrote:

Brian,

Put the values into column Z, then get a formula to work of the form

=IF(ISNA( Current Formula ), Z5, Current Formula)

Once the formula works, use the macro recorder to record entering the
formula in the cells to get the correct VBA code.

HTH,
Bernie
MS Excel MVP


"Brian" wrote in message
...
Hello,

I have a situation where I am referencing data on another workbook. The
reason behind this is the data in Column H can be entered incorrectly and
often is. I am able to prevent this going forward but can not do so for
the
items already entered. I enter a formula via VBA, however, sometimes the
result will be #N/A and if so I would prefer to leave the old value and
just
highlight it that it needs to be verified by hand.

I am not sure if I can just "leave" the value as it has pretty much
already
been replaced. Due to this, I copy the column to a different column and
what
I hope to do is copy back the same row from column Z back to H if #N/A...
I
have tried to write this 50 different ways but for some reason I am having
major problems. This is how I enter the formula and copy the pre formula
value to Z... Any help will be greatly appreciated!

With Workbooks("P-Score and Q-Score trends.xlsx").Worksheets("FO Ref
List")
Columns("H").Copy
Range("Z1").PasteSpecial
With .Range("G5", .Range("G5").End(xlDown)).Offset(, 1)
.FormulaR1C1 = "=INDEX('[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C21,MATCH(RC7,'[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C26,0))%26"", ""%26INDEX('[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C20,MATCH(RC7,'[March 2010 ADIM 1047 report
(4).xls]ADIMR1047'!C26,0))"
.Value = .Value
End With
End With

Thank you!



.

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
VBA referencing the result of a formula Jock Excel Programming 6 June 23rd 09 03:10 PM
Referencing a different tab according to a formula result Ditch Excel Worksheet Functions 2 July 9th 07 06:16 AM
need help referencing cell using result of formula nosliw Excel Discussion (Misc queries) 1 April 1st 06 06:54 AM
Auto Update of a field referencing to a field in another workbook Camper Joe Excel Worksheet Functions 1 February 14th 06 06:14 PM
referencing autofilter result EH003268 Excel Discussion (Misc queries) 2 August 24th 05 02:43 PM


All times are GMT +1. The time now is 05:49 AM.

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

About Us

"It's about Microsoft Excel"