Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bud Bud is offline
external usenet poster
 
Posts: 61
Default Indirect and matching formula isn't working

Hello

Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"
---This is the formula I am using today and it works fine to do matching.

However, I wanted to be able to replace the 8000 in that formula with an
actual row count that I am obtaining and placing in a field called BR.

Someone suggested I use the INDIRECT function and I just can't get it to
work. I have tried everything...adding the WorksheetFunction...placing double
quotes...placing an ISERROR.

I have gotton everything from syntax error to Run time error
1004....Application-defined or object defined error trying to use this
INDIRECT.......
Cells(2, "k") = "=IF(ISERROR(WorksheetFunction.INDIRECT(""$b$2:$b$ "" &
S1))="""","""",(INDEX(Personnel!$B$1:$B$1000,MATCH (WorksheetFunction.INDIRECT(""$b$2:$b$"" & S1)),Personnel!$A$1:$A$1000,0))))"

All I want to do is take this following formula that works and replace the
8000 in that formula with an actual row count that I am obtaining and placing
in a field called BR.
Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"

Is there something that can do this besides the INDIRECT or can someone help
setup the formula with the INDIRECT so it works?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Indirect and matching formula isn't working

Not sure what the field BR is but get your row count into a vba variable and
simply concatenate it into the formula like following.

Note: It is one line of code.

myRowCount = 8008 'Assign row number to a variable

Cells(2, "k") =
"=IF($b$2:$b$" & myRowCount &
"="""","""",(INDEX(Personnel!$B$1:$B$1000,MATCH($b $2:$b$" & myRowCount &
",Personnel!$A$1:$A$1000,0))))"

--
Regards,

OssieMac


"Bud" wrote:

Hello

Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"
---This is the formula I am using today and it works fine to do matching.

However, I wanted to be able to replace the 8000 in that formula with an
actual row count that I am obtaining and placing in a field called BR.

Someone suggested I use the INDIRECT function and I just can't get it to
work. I have tried everything...adding the WorksheetFunction...placing double
quotes...placing an ISERROR.

I have gotton everything from syntax error to Run time error
1004....Application-defined or object defined error trying to use this
INDIRECT.......
Cells(2, "k") = "=IF(ISERROR(WorksheetFunction.INDIRECT(""$b$2:$b$ "" &
S1))="""","""",(INDEX(Personnel!$B$1:$B$1000,MATCH (WorksheetFunction.INDIRECT(""$b$2:$b$"" & S1)),Personnel!$A$1:$A$1000,0))))"

All I want to do is take this following formula that works and replace the
8000 in that formula with an actual row count that I am obtaining and placing
in a field called BR.
Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"

Is there something that can do this besides the INDIRECT or can someone help
setup the formula with the INDIRECT so it works?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Indirect and matching formula isn't working

Check your other post.

Bud wrote:

Hello

Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"
---This is the formula I am using today and it works fine to do matching.

However, I wanted to be able to replace the 8000 in that formula with an
actual row count that I am obtaining and placing in a field called BR.

Someone suggested I use the INDIRECT function and I just can't get it to
work. I have tried everything...adding the WorksheetFunction...placing double
quotes...placing an ISERROR.

I have gotton everything from syntax error to Run time error
1004....Application-defined or object defined error trying to use this
INDIRECT.......
Cells(2, "k") = "=IF(ISERROR(WorksheetFunction.INDIRECT(""$b$2:$b$ "" &
S1))="""","""",(INDEX(Personnel!$B$1:$B$1000,MATCH (WorksheetFunction.INDIRECT(""$b$2:$b$"" & S1)),Personnel!$A$1:$A$1000,0))))"

All I want to do is take this following formula that works and replace the
8000 in that formula with an actual row count that I am obtaining and placing
in a field called BR.
Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"

Is there something that can do this besides the INDIRECT or can someone help
setup the formula with the INDIRECT so it works?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bud Bud is offline
external usenet poster
 
Posts: 61
Default Indirect and matching formula isn't working

Thank You so much!

"OssieMac" wrote:

Not sure what the field BR is but get your row count into a vba variable and
simply concatenate it into the formula like following.

Note: It is one line of code.

myRowCount = 8008 'Assign row number to a variable

Cells(2, "k") =
"=IF($b$2:$b$" & myRowCount &
"="""","""",(INDEX(Personnel!$B$1:$B$1000,MATCH($b $2:$b$" & myRowCount &
",Personnel!$A$1:$A$1000,0))))"

--
Regards,

OssieMac


"Bud" wrote:

Hello

Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"
---This is the formula I am using today and it works fine to do matching.

However, I wanted to be able to replace the 8000 in that formula with an
actual row count that I am obtaining and placing in a field called BR.

Someone suggested I use the INDIRECT function and I just can't get it to
work. I have tried everything...adding the WorksheetFunction...placing double
quotes...placing an ISERROR.

I have gotton everything from syntax error to Run time error
1004....Application-defined or object defined error trying to use this
INDIRECT.......
Cells(2, "k") = "=IF(ISERROR(WorksheetFunction.INDIRECT(""$b$2:$b$ "" &
S1))="""","""",(INDEX(Personnel!$B$1:$B$1000,MATCH (WorksheetFunction.INDIRECT(""$b$2:$b$"" & S1)),Personnel!$A$1:$A$1000,0))))"

All I want to do is take this following formula that works and replace the
8000 in that formula with an actual row count that I am obtaining and placing
in a field called BR.
Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"

Is there something that can do this besides the INDIRECT or can someone help
setup the formula with the INDIRECT so it works?

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
Indirect formula not working if I give custom name for Sheets Narnimar Excel Discussion (Misc queries) 6 February 5th 09 10:33 PM
Indirect formula not working if I give custom name for Sheets Elkar Excel Discussion (Misc queries) 0 February 5th 09 09:13 PM
Indirect formula not working if I give custom name for Sheets Narnimar Excel Discussion (Misc queries) 0 February 5th 09 09:13 PM
Indirect.ext Function Isn't Working for me [email protected] Excel Programming 0 January 17th 08 07:54 PM
Sumproduct - Indirect - NOT WORKING????? Please help Teddy-B Excel Discussion (Misc queries) 4 October 19th 07 09:15 PM


All times are GMT +1. The time now is 07:56 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"