A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Return Numerical Label for LAST value Subtracted to reach Sum Target Value



 
 
Thread Tools Display Modes
  #1  
Old October 28th, 2005, 10:01 PM
Sam via OfficeKB.com
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Hi All,

I am looking for a Formula that can process the following:

The Sum Target Value is variable e.g.; 147
I have two columns of numerical values: Column “A” and Column “B.”
Column “A” Houses the Numerical Labels that I wish to have Returned when the
Sum Target Value is processed /reached - Subtract Sum Target Value as noted
below.

To Subtract Sum Target Value:
Start from LAST non-zero numerical value in Column “B” and Subtract one Cell
value at a time (or Sum up the Column) until the Sum Target Value or nearest
possible Sum BELOW, the Sum Target Value is reached. In this instance, it is
147. I wish to Sum the values in Column “B” to 147 per the above. The
summed values can be below BUT NOT over the Sum Target Value.

Return the Numerical Value that is Offset ONE Cell to the LEFT (Column “A”)
and ONE Row Above LAST value Subtracted (in Column “B”) to reach Sum Target
Value. The Result – Numerical Label should come from Column “A.”


Col “A” Col “B”
200 3
205 1
210 5
215 11
220 10
225 15
230 16
235 10
240 11
245 29
250 20
255 27
260 22
265 34
270 24
275 36
280 30
285 25
290 31
295 26
300 15
305 18
310 23
315 17
320 9
325 11
330 2
335 9
340 1
0 0

Reaching the Sum Target Value of 147 in Column “B” would go up to value 26,
Label 295 in Column “A”, totalling 131 which is below the Sum Target 147 but
including the value of 31 above it, would exceed the Sum Target Value of 147.
The required Result is returned from Column “A” Label 290 which is ONE Cell
to the LEFT (Column “A”) and ONE Row Above LAST value Subtracted (in Column
“B”).

Thanks
Sam


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200510/1
  #2  
Old October 29th, 2005, 04:27 AM
Ron Rosenfeld
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

On Fri, 28 Oct 2005 21:01:37 GMT, "Sam via OfficeKB.com" u4102@uwe wrote:

Hi All,

I am looking for a Formula that can process the following:

The Sum Target Value is variable e.g.; 147
I have two columns of numerical values: Column “A” and Column “B.”
Column “A” Houses the Numerical Labels that I wish to have Returned when the
Sum Target Value is processed /reached - Subtract Sum Target Value as noted
below.

To Subtract Sum Target Value:
Start from LAST non-zero numerical value in Column “B” and Subtract one Cell
value at a time (or Sum up the Column) until the Sum Target Value or nearest
possible Sum BELOW, the Sum Target Value is reached. In this instance, it is
147. I wish to Sum the values in Column “B” to 147 per the above. The
summed values can be below BUT NOT over the Sum Target Value.

Return the Numerical Value that is Offset ONE Cell to the LEFT (Column “A”)
and ONE Row Above LAST value Subtracted (in Column “B”) to reach Sum Target
Value. The Result – Numerical Label should come from Column “A.”


Col “A” Col “B”
200 3
205 1
210 5
215 11
220 10
225 15
230 16
235 10
240 11
245 29
250 20
255 27
260 22
265 34
270 24
275 36
280 30
285 25
290 31
295 26
300 15
305 18
310 23
315 17
320 9
325 11
330 2
335 9
340 1
0 0

Reaching the Sum Target Value of 147 in Column “B” would go up to value 26,
Label 295 in Column “A”, totalling 131 which is below the Sum Target 147 but
including the value of 31 above it, would exceed the Sum Target Value of 147.
The required Result is returned from Column “A” Label 290 which is ONE Cell
to the LEFT (Column “A”) and ONE Row Above LAST value Subtracted (in Column
“B”).

Thanks
Sam


Here's one way that'll get you the correct answer. It involves adding a third
column:

C1: =SUM(B1:$B$30)

Then copy/drag down to C30.

The formula that will return the Label would then be:

=INDEX(A1:A30,MATCH(target_value,C1:C30,-1)+(COUNTIF(C1:C30,target_value)=0))


--ron
  #3  
Old October 29th, 2005, 10:55 AM
Domenic
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Try the following...

First, define dynamic ranges for Column A and Column B...

Insert Name Define

Name: NumLabels

Refers to:

=Sheet1!$A$1:INDEX(Sheet1!$A:$A,MATCH(9.9999999999 9999E+307,Sheet1!$A:$A)
)

Click Add

Name: Values

Refers to:

=Sheet1!$B$1:INDEX(Sheet1!$B:$B,MATCH(9.9999999999 9999E+307,Sheet1!$A:$A)
)

Click Ok

Then use the following array formula that needs to be confirmed with
CONTROL+SHIFT+ENTER...

=INDEX(NumLabels,ROWS(Values)-MATCH(TRUE,SUBTOTAL(9,OFFSET(Values,ROWS(Va
lues)-1,0,-SMALL(ROW(Values)-MIN(ROW(Values))+1,ROW(Values)-MIN(ROW(Value
s))+1)))=C1,0)+1)

....where C1 contains your 'Sum Target Value'.

Hope this helps!

In article 5687cfd849b98@uwe, "Sam via OfficeKB.com" u4102@uwe
wrote:

Hi All,

I am looking for a Formula that can process the following:

The Sum Target Value is variable e.g.; 147
I have two columns of numerical values: Column “A” and Column “B.”
Column “A” Houses the Numerical Labels that I wish to have Returned when the
Sum Target Value is processed /reached - Subtract Sum Target Value as noted
below.

To Subtract Sum Target Value:
Start from LAST non-zero numerical value in Column “B” and Subtract one Cell
value at a time (or Sum up the Column) until the Sum Target Value or nearest
possible Sum BELOW, the Sum Target Value is reached. In this instance, it is
147. I wish to Sum the values in Column “B” to 147 per the above. The
summed values can be below BUT NOT over the Sum Target Value.

Return the Numerical Value that is Offset ONE Cell to the LEFT (Column “A”)
and ONE Row Above LAST value Subtracted (in Column “B”) to reach Sum Target
Value. The Result – Numerical Label should come from Column “A.”


Col “A” Col “B”
200 3
205 1
210 5
215 11
220 10
225 15
230 16
235 10
240 11
245 29
250 20
255 27
260 22
265 34
270 24
275 36
280 30
285 25
290 31
295 26
300 15
305 18
310 23
315 17
320 9
325 11
330 2
335 9
340 1
0 0

Reaching the Sum Target Value of 147 in Column “B” would go up to value 26,
Label 295 in Column “A”, totalling 131 which is below the Sum Target 147 but
including the value of 31 above it, would exceed the Sum Target Value of 147.
The required Result is returned from Column “A” Label 290 which is ONE Cell
to the LEFT (Column “A”) and ONE Row Above LAST value Subtracted (in Column
“B”).

Thanks
Sam

  #4  
Old October 29th, 2005, 07:00 PM
Ron Rosenfeld
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

On Fri, 28 Oct 2005 23:27:57 -0400, Ron Rosenfeld
wrote:

On Fri, 28 Oct 2005 21:01:37 GMT, "Sam via OfficeKB.com" u4102@uwe wrote:

Hi All,

I am looking for a Formula that can process the following:

The Sum Target Value is variable e.g.; 147
I have two columns of numerical values: Column “A” and Column “B.”
Column “A” Houses the Numerical Labels that I wish to have Returned when the
Sum Target Value is processed /reached - Subtract Sum Target Value as noted
below.

To Subtract Sum Target Value:
Start from LAST non-zero numerical value in Column “B” and Subtract one Cell
value at a time (or Sum up the Column) until the Sum Target Value or nearest
possible Sum BELOW, the Sum Target Value is reached. In this instance, it is
147. I wish to Sum the values in Column “B” to 147 per the above. The
summed values can be below BUT NOT over the Sum Target Value.

Return the Numerical Value that is Offset ONE Cell to the LEFT (Column “A”)
and ONE Row Above LAST value Subtracted (in Column “B”) to reach Sum Target
Value. The Result – Numerical Label should come from Column “A.”


Col “A” Col “B”
200 3
205 1
210 5
215 11
220 10
225 15
230 16
235 10
240 11
245 29
250 20
255 27
260 22
265 34
270 24
275 36
280 30
285 25
290 31
295 26
300 15
305 18
310 23
315 17
320 9
325 11
330 2
335 9
340 1
0 0

Reaching the Sum Target Value of 147 in Column “B” would go up to value 26,
Label 295 in Column “A”, totalling 131 which is below the Sum Target 147 but
including the value of 31 above it, would exceed the Sum Target Value of 147.
The required Result is returned from Column “A” Label 290 which is ONE Cell
to the LEFT (Column “A”) and ONE Row Above LAST value Subtracted (in Column
“B”).

Thanks
Sam


Here's one way that'll get you the correct answer. It involves adding a third
column:

C1: =SUM(B1:$B$30)

Then copy/drag down to C30.

The formula that will return the Label would then be:

=INDEX(A1:A30,MATCH(target_value,C1:C30,-1)+(COUNTIF(C1:C30,target_value)=0))


--ron



I misread your specifications. The correct formula would be:

=INDEX(A1:A30,MATCH(D1,C1:C30,-1))


--ron
  #5  
Old October 29th, 2005, 07:06 PM
Sam via OfficeKB.com
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Hi Ron,

Thank you. I really do appreciate you taking the time and effort to provide a
workable solution to my often not so clear scenarios.

Ron Rosenfeld wrote:
Here's one way that'll get you the correct answer. It involves adding a third column:


C1: =SUM(B1:$B$30)
Then copy/drag down to C30.
The formula that will return the Label would then be:
=INDEX(A1:A30,MATCH(target_value,C1:C30,-1)+(COUNTIF(C1:C30,target_value)=0))


--ron


Your Formula gets me very close to my required Result. It provides the
Numeric Label of the Summed Target Value; however, the required Result is the
Numeric Label ONE Row above the Numeric Label of the Summed Target Value. I
would have subtracted the value of one (1) from the Result returned by the
Formula but unfortunately, in a few cases the Numeric Label above the Summed
Target Value could be zero (0). Is there anyway of adding to your existing
Formula to return the Numeric Label that is one Row above the Summed Target
Value, excluding any Numeric Labels of zero (0) and thus returning what would
be the next non-zero Numeric Label.

Apologies for my over simplified example.

Further assistance appreciated.

Cheers
Sam

Ron Rosenfeld wrote:
Here's one way that'll get you the correct answer. It involves adding a third
column:

C1: =SUM(B1:$B$30)

Then copy/drag down to C30.

The formula that will return the Label would then be:

=INDEX(A1:A30,MATCH(target_value,C1:C30,-1)+(COUNTIF(C1:C30,target_value)=0))

--ron



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200510/1
  #6  
Old October 29th, 2005, 07:42 PM
Sam via OfficeKB.com
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Hi Domenic,

Thank you. Your time and assistance is very much appreciated.

Your Formula does provide exactly what I requested. Unfortunately, I over
simplified the example: in a few cases the Numeric Label above the Summed
Target Value could be zero (0). Is there anyway of adapting your existing
Formula to exclude any Numeric Labels of zero (0) and thus return what would
be the next non-zero Numeric Label.

Apologies for my over simplified example.

Further assistance appreciated.

Cheers,
Sam


Domenic wrote:
Try the following...

First, define dynamic ranges for Column A and Column B...

Insert Name Define

Name: NumLabels

Refers to:

=Sheet1!$A$1:INDEX(Sheet1!$A:$A,MATCH(9.999999999 99999E+307,Sheet1!$A:$A)
)

Click Add

Name: Values

Refers to:

=Sheet1!$B$1:INDEX(Sheet1!$B:$B,MATCH(9.999999999 99999E+307,Sheet1!$A:$A)
)

Click Ok

Then use the following array formula that needs to be confirmed with
CONTROL+SHIFT+ENTER...

=INDEX(NumLabels,ROWS(Values)-MATCH(TRUE,SUBTOTAL(9,OFFSET(Values,ROWS(Va
lues)-1,0,-SMALL(ROW(Values)-MIN(ROW(Values))+1,ROW(Values)-MIN(ROW(Value
s))+1)))=C1,0)+1)

...where C1 contains your 'Sum Target Value'.

Hope this helps!

Hi All,

[quoted text clipped - 58 lines]
Thanks
Sam



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200510/1
  #7  
Old October 29th, 2005, 08:29 PM
Domenic
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Hi Sam!

No problem, see if this is what you're looking for...

D1:

=ROWS(Values)-MATCH(TRUE,SUBTOTAL(9,OFFSET(Values,ROWS(Values)-1,0,-SMALL
(ROW(Values)-MIN(ROW(Values))+1,ROW(Values)-MIN(ROW(Values))+1)))=C1,0)+
1

....confirmed with CONTROL+SHIFT+ENTER

E1:

=LOOKUP(2,1/(A1:INDEX(NumLabels,D1)0),A1:INDEX(NumLabels,D1))

Note that I've assumed that your data doesn't contain negative numbers.

Hope this helps!

In article 56932bf9b7374@uwe, "Sam via OfficeKB.com" u4102@uwe
wrote:

Hi Domenic,

Thank you. Your time and assistance is very much appreciated.

Your Formula does provide exactly what I requested. Unfortunately, I over
simplified the example: in a few cases the Numeric Label above the Summed
Target Value could be zero (0). Is there anyway of adapting your existing
Formula to exclude any Numeric Labels of zero (0) and thus return what would
be the next non-zero Numeric Label.

Apologies for my over simplified example.

Further assistance appreciated.

Cheers,
Sam

  #8  
Old October 29th, 2005, 08:40 PM
Sam via OfficeKB.com
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Hi Ron,

Ron Rosenfeld wrote:
I misread your specifications. The correct formula would be:


=INDEX(A1:A30,MATCH(D1,C1:C30,-1))


Your Formula does now provide exactly what I requested. Unfortunately, I over
simplified the example: in a few cases the Numeric Label above the Summed
Target Value could be zero (0). Is there anyway of adapting your existing
Formula to exclude any Numeric Labels of zero (0) and thus return what would
be the next non-zero Numeric Label.

Apologies for my over simplified example.

Further assistance much appreciated.

Cheers,
Sam


Ron Rosenfeld wrote:
Hi All,

[quoted text clipped - 71 lines]

--ron


I misread your specifications. The correct formula would be:

=INDEX(A1:A30,MATCH(D1,C1:C30,-1))

--ron



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200510/1
  #9  
Old October 29th, 2005, 09:08 PM
Sam via OfficeKB.com
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Hi Domenic,

That's Great!

Cheers,
Sam

Domenic wrote:
D1:
=ROWS(Values)-MATCH(TRUE,SUBTOTAL(9,OFFSET(Values,ROWS(Values)-1,0,-SMALL
(ROW(Values)-MIN(ROW(Values))+1,ROW(Values)-MIN(ROW(Values))+1)))=C1,0)+1
...confirmed with CONTROL+SHIFT+ENTER


E1:
=LOOKUP(2,1/(A1:INDEX(NumLabels,D1)0),A1:INDEX(NumLabels,D1))


Note that I've assumed that your data doesn't contain negative numbers.


Hope this helps!



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200510/1
  #10  
Old October 30th, 2005, 01:45 AM
Domenic
external usenet poster
 
Posts: n/a
Default Return Numerical Label for LAST value Subtracted to reach Sum Target Value

Hi Sam!

After looking at this again, I've come up with another formula to
replace the first one, which I believe is more efficient...

D1:

=ROWS(Values)-MATCH(TRUE,MMULT(--(LARGE(ROW(Values),ROW(Values)-MIN(ROW(V
alues))+1)=TRANSPOSE(ROW(Values))),Values)=C1,0) +1

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article ,
Domenic wrote:

Hi Sam!

No problem, see if this is what you're looking for...

D1:

=ROWS(Values)-MATCH(TRUE,SUBTOTAL(9,OFFSET(Values,ROWS(Values)-1,0,-SMALL
(ROW(Values)-MIN(ROW(Values))+1,ROW(Values)-MIN(ROW(Values))+1)))=C1,0)+
1

...confirmed with CONTROL+SHIFT+ENTER

E1:

=LOOKUP(2,1/(A1:INDEX(NumLabels,D1)0),A1:INDEX(NumLabels,D1))

Note that I've assumed that your data doesn't contain negative numbers.

Hope this helps!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make custom label with graphics and return address default? Kgailla General Discussion 1 September 22nd, 2005 06:04 AM
AVERAGE Row of Numbers and Return Corresponding Numeric Label Sam via OfficeKB.com Worksheet Functions 14 September 20th, 2005 01:07 AM
need to return Pass or Fail to text box or label dtoney New Users 4 February 8th, 2005 06:31 PM
Custom return address label for Word 2003 Stewart, Patrick General Discussion 1 October 11th, 2004 08:52 PM
Return target cell if its' answer is true. Ken Wright Worksheet Functions 2 January 14th, 2004 07:20 PM


All times are GMT +1. The time now is 08:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.