Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2007

Tip: Looking for answers? Try searching our database.

Help with formula (conditional list)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jg70124@gmail.com - 23 Sep 2007 14:22 GMT
I'm trying to get the sum of a set of cells, where the set is
determined by the result of a calculation.

Here's what I want to do:
- If 0 <= a1 < 30, return 0
- If 30 <= a1 < 60, return sum(d2)
- If 60 <= a1 < 90, return sum(c2:d2)
- If 90 <= a1 < 120, return (b2:d2)
- If 120 <=a1 < 150, return (a2:d2)

Of course I can do this with a bunch of nested if statements, but I
wondered if there was a more elegant way to do it.

Thanks.
Dana DeLouis - 23 Sep 2007 14:47 GMT
How about...

=IF(OR(A1<30,A1>=150),0,SUM(OFFSET(D2,0,0,1,-INT(A1/30))))

Signature

HTH   :>)
Dana DeLouis
Windows XP & Excel 2007

> I'm trying to get the sum of a set of cells, where the set is
> determined by the result of a calculation.
[quoted text clipped - 10 lines]
>
> Thanks.
jg70124@gmail.com - 24 Sep 2007 16:02 GMT
> How about...
>
[quoted text clipped - 4 lines]
> Dana DeLouis
> Windows XP & Excel 2007

Dana - Excellent.

For some reason the first condition 0 was stumping me - the if
statement is a great solution. And I was using
indirect(address(offset))), so just using the width parameter is
another great tip.

J
Earl Kiosterud - 23 Sep 2007 14:50 GMT
jg,

You can do this with a lookup table, and a VLOOKUP.  If you're not using a non-proportional
font like Courier in your newsreader, this table will be skewed.

    A   B
5    0  0
6   30  =D2
7   60  =SUM(C2:D2)
8   90  =SUM(B2:D2)
9  120  =SUM(A2:D2)
10 150

For the result:
=VLOOKUP(A1,A5:B10,2)

Signature

Regards from Virginia Beach,

Earl Kiosterud
www.smokeylake.com

   Note: Top-posting has been the norm here.
   Some folks prefer bottom-posting.
   But if you bottom-post to a reply that's
   already top-posted, the thread gets messy.
   When in Rome...
-----------------------------------------------------------------------

> I'm trying to get the sum of a set of cells, where the set is
> determined by the result of a calculation.
[quoted text clipped - 10 lines]
>
> Thanks.
Bob Phillips - 23 Sep 2007 14:51 GMT
I would think that any other solution would be overly-contrived, due to the
non-linearity of the ranges being summed.

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> I'm trying to get the sum of a set of cells, where the set is
> determined by the result of a calculation.
[quoted text clipped - 10 lines]
>
> Thanks.
Bob Phillips - 23 Sep 2007 15:02 GMT
Oops, there is a linearity, as Dana shows. Oh well.

Signature

HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

>I would think that any other solution would be overly-contrived, due to the
>non-linearity of the ranges being summed.
[quoted text clipped - 13 lines]
>>
>> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.