#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default Vlookup Function

I have a worksheet that I'm trying to match up data against another.
In the worksheet that has the detail I have 3 columns that I need to match.
I want to have it return a value of "3" if it matches all 3 of the columns
and a "0" if it doesn't. My summary sheet has the same 3 columns so I need to
find exact matches for both worksheets for those 3 columns. I hope I'm making
sense here. I assume I would use the "VLookup" function but I'm unsure how to
write the code out to find matches for all 3 columns.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

One way,

Assuming the 3 source cols are cols A to C in Sheet1, data from row 2 to 100.

Try something like this in say, Sheet2's D2, array-entered with CSE**:
=IF(ISNUMBER(MATCH(1,(Sheet1!$A$2:$A$100=A2)*(Shee t1!$B$2:$B$100=B2)*(Sheet1!$C$2:$C$100=C2),0)),3,0 )
Copy D2 down to return correspondingly for other sets of inputs in A3:C3,
A4:C4, etc

**press CTRL+SHIFT+ENTER to confirm the formula,
instead of just pressing ENTER
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote:
I have a worksheet that I'm trying to match up data against another.
In the worksheet that has the detail I have 3 columns that I need to match.
I want to have it return a value of "3" if it matches all 3 of the columns
and a "0" if it doesn't. My summary sheet has the same 3 columns so I need to
find exact matches for both worksheets for those 3 columns. I hope I'm making
sense here. I assume I would use the "VLookup" function but I'm unsure how to
write the code out to find matches for all 3 columns.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default Vlookup Function

Hi Max,

Thanks for that code. But I'm getting all 0's for everything. Could it be
that the detail in column A is a combination of text and numbers? Is the code
only going to work if the data is all numbers?

"Max" wrote:

One way,

Assuming the 3 source cols are cols A to C in Sheet1, data from row 2 to 100.

Try something like this in say, Sheet2's D2, array-entered with CSE**:
=IF(ISNUMBER(MATCH(1,(Sheet1!$A$2:$A$100=A2)*(Shee t1!$B$2:$B$100=B2)*(Sheet1!$C$2:$C$100=C2),0)),3,0 )
Copy D2 down to return correspondingly for other sets of inputs in A3:C3,
A4:C4, etc

**press CTRL+SHIFT+ENTER to confirm the formula,
instead of just pressing ENTER
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote:
I have a worksheet that I'm trying to match up data against another.
In the worksheet that has the detail I have 3 columns that I need to match.
I want to have it return a value of "3" if it matches all 3 of the columns
and a "0" if it doesn't. My summary sheet has the same 3 columns so I need to
find exact matches for both worksheets for those 3 columns. I hope I'm making
sense here. I assume I would use the "VLookup" function but I'm unsure how to
write the code out to find matches for all 3 columns.

  #4   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

Try this variation which might better suit the possible underlying data types
(text & text numbers mixed with real numbers) that you're trying to match.
Array-entered with CSE, as befo

=IF(ISNUMBER(MATCH(1,(TRIM(Sheet1!$A$2:$A$100)=A2& "")*(TRIM(Sheet1!$B$2:$B$100)=B2&"")*(TRIM(Sheet1! $C$2:$C$100)=C2&""),0)),3,0)

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote:
Hi Max,
Thanks for that code. But I'm getting all 0's for everything. Could it be
that the detail in column A is a combination of text and numbers? Is the code
only going to work if the data is all numbers?

  #5   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

.. But I'm getting all 0's for everything ..

Another point ... The above could also be symptomatic that the earlier
expression was not **array-entered** correctly. If array-entered correctly,
Excel will wrap curly braces: { } around the formula. See these curly braces
appear in the formula bar as a visual check that it's array-entered
correctly. If you don't see it, then the expression hasn't been entered
correctly and it'll return wrong results (all you'd get are zeros).

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default Vlookup Function

Perfect! It works great now! Thanks Max!!!

SS

"Max" wrote:

Try this variation which might better suit the possible underlying data types
(text & text numbers mixed with real numbers) that you're trying to match.
Array-entered with CSE, as befo

=IF(ISNUMBER(MATCH(1,(TRIM(Sheet1!$A$2:$A$100)=A2& "")*(TRIM(Sheet1!$B$2:$B$100)=B2&"")*(TRIM(Sheet1! $C$2:$C$100)=C2&""),0)),3,0)

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote:
Hi Max,
Thanks for that code. But I'm getting all 0's for everything. Could it be
that the detail in column A is a combination of text and numbers? Is the code
only going to work if the data is all numbers?

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default Vlookup Function

One follow up question...

Say instead of having it show a "3" if the match is true, could I have it
show another value from the detail worksheet? In column E of my detail
worksheet I have a record number. How could I show that value instead of a
"3"?

"Max" wrote:

Try this variation which might better suit the possible underlying data types
(text & text numbers mixed with real numbers) that you're trying to match.
Array-entered with CSE, as befo

=IF(ISNUMBER(MATCH(1,(TRIM(Sheet1!$A$2:$A$100)=A2& "")*(TRIM(Sheet1!$B$2:$B$100)=B2&"")*(TRIM(Sheet1! $C$2:$C$100)=C2&""),0)),3,0)

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote:
Hi Max,
Thanks for that code. But I'm getting all 0's for everything. Could it be
that the detail in column A is a combination of text and numbers? Is the code
only going to work if the data is all numbers?

  #8   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

Pleased to hear that. You're welcome.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote in
message ...
Perfect! It works great now! Thanks Max!!!
SS



  #9   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

Try something along the lines of this amendment,
array-entered with CSE, as befo

=IF(ISNA(MATCH(1,(TRIM(Sheet1!$A$2:$A$100)=A2&"")* (TRIM(Sheet1!$B$2:$B$100)=B2&"")*(TRIM(Sheet1!$C$2 :$C$100)=C2&""),0)),"",INDEX(Sheet1!$E$2:$E$100,MA TCH(1,(TRIM(Sheet1!$A$2:$A$100)=A2&"")*(TRIM(Sheet 1!$B$2:$B$100)=B2&"")*(TRIM(Sheet1!$C$2:$C$100)=C2 &""),0)))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote:
One follow up question...

Say instead of having it show a "3" if the match is true, could I have it
show another value from the detail worksheet? In column E of my detail
worksheet I have a record number. How could I show that value instead of a
"3"?


  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default Vlookup Function

Thanks Max! That covers everything!


"Max" wrote:

Try something along the lines of this amendment,
array-entered with CSE, as befo

=IF(ISNA(MATCH(1,(TRIM(Sheet1!$A$2:$A$100)=A2&"")* (TRIM(Sheet1!$B$2:$B$100)=B2&"")*(TRIM(Sheet1!$C$2 :$C$100)=C2&""),0)),"",INDEX(Sheet1!$E$2:$E$100,MA TCH(1,(TRIM(Sheet1!$A$2:$A$100)=A2&"")*(TRIM(Sheet 1!$B$2:$B$100)=B2&"")*(TRIM(Sheet1!$C$2:$C$100)=C2 &""),0)))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote:
One follow up question...

Say instead of having it show a "3" if the match is true, could I have it
show another value from the detail worksheet? In column E of my detail
worksheet I have a record number. How could I show that value instead of a
"3"?




  #11   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Vlookup Function

Glad it did. Cheers.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Secret Squirrel" wrote in
message ...
Thanks Max! That covers everything!



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
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
Embedded VLOOKUP function within IF function beautyteknorth Excel Worksheet Functions 6 August 17th 06 09:31 AM
HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION CHAIM Excel Worksheet Functions 1 July 27th 05 09:10 PM
how do I write a vlookup function within an iserror function so t. JBLeeds Excel Worksheet Functions 2 March 16th 05 10:30 AM
I want to use Vlookup function and AND function in a single formu. prakash Excel Worksheet Functions 3 January 25th 05 07:11 AM


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