Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jeff
 
Posts: n/a
Default Urgent Dynamic Range with Vlookup

I urgently need to define a formula that execute the following:

I need to do a vlookup on Value 1 to return in the value in column "C" ONLY
AND ONLY IF the value in column "B" is "SP". Then I need to do a vlookup on
Value 1 to return the value in column "C" ONLY ANLY IF the value in column
"B" is "ZA"



Value 1 SP 1000035
Value 1 ZA 1000036
--
Regards,
Jeff

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

If I understand correctly, you just want to match both column A and column B and
return the value in column C for the first row that matches A:B.

=index(othersheet!$c$1:$c$100,
match(1,(a2=othersheet!$a$1:$a$100)*(b2=othersheet !$b$1:$b$100),0))

or

=index(othersheet!$c$1:$c$100,
match(1,("Value 1"=othersheet!$a$1:$a$100)*("SP"=othersheet!$b$1:$ b$100),0))

(one cell)

These are both array formulas. Hit ctrl-shift-enter instead of enter. If you
do it correctly, excel will wrap curly brackets {} around your formula. (don't
type them yourself.)

Adjust the range to match--but you can't use the whole column.

Jeff wrote:

I urgently need to define a formula that execute the following:

I need to do a vlookup on Value 1 to return in the value in column "C" ONLY
AND ONLY IF the value in column "B" is "SP". Then I need to do a vlookup on
Value 1 to return the value in column "C" ONLY ANLY IF the value in column
"B" is "ZA"

Value 1 SP 1000035
Value 1 ZA 1000036
--
Regards,
Jeff


--

Dave Peterson
  #3   Report Post  
Jeff
 
Posts: n/a
Default

Hi Dave,

How would you write a VBA procedure to run this function on the whole column?

--
Regards,
Jeff



"Dave Peterson" wrote:

If I understand correctly, you just want to match both column A and column B and
return the value in column C for the first row that matches A:B.

=index(othersheet!$c$1:$c$100,
match(1,(a2=othersheet!$a$1:$a$100)*(b2=othersheet !$b$1:$b$100),0))

or

=index(othersheet!$c$1:$c$100,
match(1,("Value 1"=othersheet!$a$1:$a$100)*("SP"=othersheet!$b$1:$ b$100),0))

(one cell)

These are both array formulas. Hit ctrl-shift-enter instead of enter. If you
do it correctly, excel will wrap curly brackets {} around your formula. (don't
type them yourself.)

Adjust the range to match--but you can't use the whole column.

Jeff wrote:

I urgently need to define a formula that execute the following:

I need to do a vlookup on Value 1 to return in the value in column "C" ONLY
AND ONLY IF the value in column "B" is "SP". Then I need to do a vlookup on
Value 1 to return the value in column "C" ONLY ANLY IF the value in column
"B" is "ZA"

Value 1 SP 1000035
Value 1 ZA 1000036
--
Regards,
Jeff


--

Dave Peterson

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

I wouldn't.

Are you really using all 65536 rows? If you are, that's pretty amazing!

If you aren't, you could wrap application.evaluate around the expression:

dim res as variant
res = application.evaluate("index(othersheet!$c$1:$c$100 ," & _
"match(1,(a2=othersheet!$a$1:$a$100)*(b2=othershee t!$b$1:$b$100),0))")

(watch out for typos)


Jeff wrote:

Hi Dave,

How would you write a VBA procedure to run this function on the whole column?

--
Regards,
Jeff

"Dave Peterson" wrote:

If I understand correctly, you just want to match both column A and column B and
return the value in column C for the first row that matches A:B.

=index(othersheet!$c$1:$c$100,
match(1,(a2=othersheet!$a$1:$a$100)*(b2=othersheet !$b$1:$b$100),0))

or

=index(othersheet!$c$1:$c$100,
match(1,("Value 1"=othersheet!$a$1:$a$100)*("SP"=othersheet!$b$1:$ b$100),0))

(one cell)

These are both array formulas. Hit ctrl-shift-enter instead of enter. If you
do it correctly, excel will wrap curly brackets {} around your formula. (don't
type them yourself.)

Adjust the range to match--but you can't use the whole column.

Jeff wrote:

I urgently need to define a formula that execute the following:

I need to do a vlookup on Value 1 to return in the value in column "C" ONLY
AND ONLY IF the value in column "B" is "SP". Then I need to do a vlookup on
Value 1 to return the value in column "C" ONLY ANLY IF the value in column
"B" is "ZA"

Value 1 SP 1000035
Value 1 ZA 1000036
--
Regards,
Jeff


--

Dave Peterson


--

Dave Peterson
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
Dynamic named range across multiple sheets babycody Excel Discussion (Misc queries) 3 July 24th 05 06:03 AM
Dynamic Range Chart ??? Yogalete Charts and Charting in Excel 3 April 27th 05 11:51 PM
how to change range for dynamic chart in excel 2000 with button? ivan Charts and Charting in Excel 2 April 24th 05 04:10 AM
dynamic range for excel chart bobf Excel Discussion (Misc queries) 1 January 26th 05 11:07 AM
How do I use Range Names listed in a VLookup table in a formula? Essbasedvlpr32 Excel Worksheet Functions 3 December 15th 04 10:11 PM


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