Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Find what numbers add up to a specific number

Hello,

I would like to know if there is a function which I could use to search a
column to find values which would equal a certain value.

For instance I have a list of:

1
2
8
98
65
45
25
98

I would like to search that column for any of those values which would add
to 123. The function would then return or highlight the 98 and 25 because
those add up to 123.

Is there a way I can do this?

Thanks for your help!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Find what numbers add up to a specific number

See:

http://www.tushar-mehta.com/excel/te...olver_Template


--
Gary''s Student - gsnu200840


"heathersm1" wrote:

Hello,

I would like to know if there is a function which I could use to search a
column to find values which would equal a certain value.

For instance I have a list of:

1
2
8
98
65
45
25
98

I would like to search that column for any of those values which would add
to 123. The function would then return or highlight the 98 and 25 because
those add up to 123.

Is there a way I can do this?

Thanks for your help!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Find what numbers add up to a specific number

Try the below code

HighlightParent 500, 1
500 is the sum
1 is the column number

Sub HighlightParent(lngSum As Long, lngCol As Long)
Dim lngRow, lngRows, lngTRow
lngRows = ActiveSheet.Cells(Rows.Count, lngCol).End(xlUp).Row
For lngRow = 1 To lngRows
For lngTRow = lngRow To lngRows
If Cells(lngRow, lngCol) + Cells(lngTRow, lngCol) = lngSum Then
Cells(lngRow, lngCol).Interior.Color = vbYellow
Cells(lngTRow, lngCol).Interior.Color = vbYellow
Exit Sub
End If
Next
Next
End Sub


"heathersm1" wrote:

Hello,

I would like to know if there is a function which I could use to search a
column to find values which would equal a certain value.

For instance I have a list of:

1
2
8
98
65
45
25
98

I would like to search that column for any of those values which would add
to 123. The function would then return or highlight the 98 and 25 because
those add up to 123.

Is there a way I can do this?

Thanks for your help!

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
Can I find a specific value in a random column of numbers yazmaz Excel Worksheet Functions 4 April 17th 07 03:55 PM
How to Find a Specific First Number in a Row AltaInd Excel Discussion (Misc queries) 4 March 2nd 07 06:57 PM
how to write function to find max deviation from specific number . barbdee Excel Worksheet Functions 2 December 16th 05 02:10 AM
how do I find an average number of specific words in a column cashgrfx New Users to Excel 7 January 6th 05 04:44 PM
find numbers in a range that add to a specific value Brett Excel Discussion (Misc queries) 1 December 20th 04 01:55 PM


All times are GMT +1. The time now is 07:02 PM.

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"