Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 557
Default Match formula to match values in multiple columns

Thanks lot Dave Peterson. Your formula works. What i was trying to
achive that i got data in three columns like see below

K L M.....col
XX YY GG
SS TT NN
RR VV AA
etc...

then i have data in column A like see below

A....col
XX
DD
SS

I needed some formula in column B to match column A values in columns
K, L and M to come back with result like see below

A B....col
XX Match
DD Dont Match
SS Match

sorry i didnt explain my question clearly as i was trying to keep it
short. The only thing i am trying to workout that how can i achive
same thing with macro. Like if i click button and column B should get
filled automatically. It will much appricated if any friend can help
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Match formula to match values in multiple columns

I'd just insert the formula into the macro:

Dim wks as worksheet
dim LastRow as long

set wks = worksheets("Sheet1")

with wks
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("B2:B" & lastrow)
.formula = "=if(countif($k$2:$M$30,a2)=0,""no match"",""match"")"
.value = .value 'convert formulas to values???
end with
end with

Notice that the double quotes in the formula string are doubled. Something to
watch out for if/when you change that formula.




K wrote:

Thanks lot Dave Peterson. Your formula works. What i was trying to
achive that i got data in three columns like see below

K L M.....col
XX YY GG
SS TT NN
RR VV AA
etc...

then i have data in column A like see below

A....col
XX
DD
SS

I needed some formula in column B to match column A values in columns
K, L and M to come back with result like see below

A B....col
XX Match
DD Dont Match
SS Match

sorry i didnt explain my question clearly as i was trying to keep it
short. The only thing i am trying to workout that how can i achive
same thing with macro. Like if i click button and column B should get
filled automatically. It will much appricated if any friend can help


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 557
Default Match formula to match values in multiple columns

On Apr 21, 4:53*pm, Dave Peterson wrote:
I'd just insert the formula into the macro:

Dim wks as worksheet
dim LastRow as long

set wks = worksheets("Sheet1")

with wks
* lastrow = .cells(.rows.count,"A").end(xlup).row
* with .range("B2:B" & lastrow)
* * .formula = "=if(countif($k$2:$M$30,a2)=0,""no match"",""match"")"
* * .value = .value 'convert formulas to values???
* end with
end with

Notice that the double quotes in the formula string are doubled. *Something to
watch out for if/when you change that formula.





K wrote:

Thanks lot Dave Peterson. *Your formula works. *What i was trying to
achive that i got data in three columns like see below


K * *L * M.....col
XX *YY GG
SS TT NN
RR VV AA
etc...


then i have data in column A like see below


A....col
XX
DD
SS


I needed some formula in column B to match column A values in columns
K, L and M to come back with result like see below


A * * *B....col
XX * *Match
DD * Dont Match
SS * Match


sorry i didnt explain my question clearly as i was trying to keep it
short. *The only thing i am trying to workout that how can i achive
same thing with macro. Like if i click button and column B should get
filled automatically. *It will much appricated if any friend can help


--

Dave Peterson- Hide quoted text -

- Show quoted text -


thanks lot dave
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
Lookup Formula: Return 1st match, then 2nd match, then 3rd match Scott Excel Discussion (Misc queries) 4 December 11th 09 05:50 AM
Need to match 2 columns, if a match found add info from 2nd column Stratton Excel Worksheet Functions 1 October 8th 08 02:55 PM
Match Values in Rows with Partial Values in Columns ryguy7272 Excel Worksheet Functions 3 August 8th 07 05:14 PM
match values in two different columns thomasNg Excel Worksheet Functions 2 November 24th 05 02:38 AM
Match values from two columns pek Excel Worksheet Functions 1 November 30th 04 03:18 PM


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