Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Vick
 
Posts: n/a
Default Matching a Value with a list

I understand the matching value formula in excel, but I'm looking for
something a little more complicated. I'm trying to take a value in column B,
and see if any combination of items in A equal that value, and if it does
what items are used to equal the amount in column B. I'm looking for
whatever help I can get. An example is below, and thanks for you help.

Column A Column B
1 4
2 7
5
47
544

For 4, the there would be no possiblity, as none of the numbers added
together can equal 4. The answer for 7 would be 5+2.
  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR
 
Posts: n/a
Default Matching a Value with a list

Well, for just a simple two-component sum, one way would be to make your list
into a matrix, with the intersections being the sum of the two legs. This
use thei Function from Gary" Student. Put the code in a regular module and
use this formula, where A1:F6 is the range of your matrix and H1 is the value
you wish to look up.

=Titles(A1:F6,H1)

Function titles(r As Range, vv As Range) As String
Dim rr As Range, s1, s2 As String, gotit As Boolean
titles = ""
gotit = False
v = vv.Value ' NEW LINE

For Each rr In r
If rr.Value = v Then
gotit = True
Exit For
End If
Next
If gotit = False Then Exit Function

s1 = Cells(r.Row, rr.Column)
s2 = Cells(rr.Row, r.Column)
titles = s1 & Chr(10) & s2
End Function

hth
Vaya con Dios,
Chuck, CABGx3



"Vick" wrote:

I understand the matching value formula in excel, but I'm looking for
something a little more complicated. I'm trying to take a value in column B,
and see if any combination of items in A equal that value, and if it does
what items are used to equal the amount in column B. I'm looking for
whatever help I can get. An example is below, and thanks for you help.

Column A Column B
1 4
2 7
5
47
544

For 4, the there would be no possiblity, as none of the numbers added
together can equal 4. The answer for 7 would be 5+2.

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
Matching Lists Where List Size is Unequal zgall1 Excel Discussion (Misc queries) 1 February 16th 06 11:21 PM
multiple select from the drop down list in excel. list in one sheet and drop down in sriramus Excel Discussion (Misc queries) 5 October 27th 05 06:55 PM
Extract multiple records matching criteria from list William DeLeo Excel Worksheet Functions 12 June 30th 05 02:35 PM
Making pick list conditional on selection from previous pick list Stewart Excel Discussion (Misc queries) 1 June 27th 05 11:30 AM
Matching a List Containing Redundant Values Rick Hess Excel Discussion (Misc queries) 1 November 26th 04 02:39 PM


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