[Solved] IF function & greater than but less than

Discuss the spreadsheet application
Post Reply
idrive
Posts: 7
Joined: Tue May 10, 2011 2:36 pm

[Solved] IF function & greater than but less than

Post by idrive »

Here is my spreadsheet setup:
B2 = Total Production [input cell]
B3 = =IF(B2<2000; B2; 2000) [First 2000 Production]
B4 = (2001-2500 Production)
B5 = =IF(B2>2500; B2-2500; 0) [Above 2500 Production]

C3 = $3.00
C4 = $3.50
C5 = $4.00

D3 = =B3*C3
D4 = =B4*C4
D5 = =B5*C5

D6 = =SUM(D3:D5)
-----------------------------------
I need B4 to function as "if B2 is >= 2001 but <= to 2500 then (B2-2000), if b2 is greater than 2500 then (2500-2001), otherwise 0.

The first 2000 Production are on a rate of $3.00, 2001-2500 are on a rate of $3.50, and greater than 2500 are on a rate of $4.00.

Thank you for the help.
Last edited by Hagar Delest on Wed May 11, 2011 9:11 pm, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 3.3.0 on Windows XP
User avatar
Robert Tucker
Volunteer
Posts: 1250
Joined: Mon Oct 08, 2007 1:34 am
Location: Manchester UK

Re: IF function & greater than but less than

Post by Robert Tucker »

Code: Select all

=IF(AND(B2>=2001;B2<=2500);B2-2000;IF(B2>2500;499;0))
Last edited by Robert Tucker on Wed May 11, 2011 6:59 pm, edited 1 time in total.
LibreOffice 7.x.x on Arch and Fedora.
gerard24
Volunteer
Posts: 958
Joined: Sat Oct 30, 2010 5:12 pm
Location: France

Re: IF function & greater than but less than

Post by gerard24 »

Hi,

in B4 :

Code: Select all

=IF(B2>2500;500;IF(AND(B2>2000;B2<=2500);B2-2000;0))
You can also make this calculation whithout all these formulae.
Only B2 cell (for input) and in D6 :

Code: Select all

=SUMPRODUCT(B2>{0;2000;2500};B2-{0;2000;2500};{3;0.5;0.5})
or with a table (see attachment).
idrive.ods
(12.4 KiB) Downloaded 920 times
Last edited by gerard24 on Wed May 11, 2011 7:28 pm, edited 1 time in total.
LibreOffice 6.4.5 on Windows 10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: IF function & greater than but less than

Post by acknak »

Yow--It looks like your price goes up for larger orders. Did I miss something?

What's to prevent me from submitting 2 separate orders for 2000 units each, just to get the cheaper price?
AOO4/LO5 • Linux • Fedora 23
idrive
Posts: 7
Joined: Tue May 10, 2011 2:36 pm

Re: IF function & greater than but less than

Post by idrive »

Haha it's actually a pay scale for shop production...so yes the price does go up for the employee. Thanks for your help Gerard...works great!
OpenOffice 3.3.0 on Windows XP
User avatar
MrProgrammer
Moderator
Posts: 5326
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: [Solved] IF function & greater than but less than

Post by MrProgrammer »

gerard24 wrote:=SUMPRODUCT(B2>{0;2000;2500};B2-{0;2000;2500};{3;0.5;0.5})
I like that method, gerard24, even better than the SUMPRODUCT formula that I posted in Multiple IF calculations for Ebay E-bay FVF fee. It only needs two constants, but my formula used three. I had to study your formula for a while to figure out why it worked, but now I understand it.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Post Reply