![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Jun 2002
Posts: 36
|
I would like to do the following
If cell A1 is less than 12 insert the number 6000 in cell B2 but If cell A1 is more than 12 then subtract 12 from cell A1 and multiply this difference by 0.4 and then add 6000 to the result. If nothing is in cell A1 blank cell B2 My attempt in cell B2 IF(A1<12,6000),IF(A1>12,(A1-12)*0.4+6000),("") eg If A1 = 12 Then B2 = 6000 If A1 = 14 Then B2 must =6800 which is(6000+(2000x0.40) If A1 is Empty B2 must remain blank Thanks Jafro the confused |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
Are you sure you want to multiply by 0.4 and not 400 (0.4*1000)? With your suggested answer of 6800, use the following =IF(LEN(A1),MAX(0,A1-12)*400+6000,"") _________________ Bye, Jay EDIT: I would like you to be clear on what you need when there is "nothing" in cell A1. Should the formula return 6000 for zero and/or negative numbers? The above will return 6000 for both of those occurrences. =IF(ISNUMBER(A1),MAX(0,A1-12)*400+6000,"") should work for erroneous entries, although you may want to keep the error to highlight them. [ This Message was edited by: Jay Petrulis on 2002-11-23 21:40 ] [ This Message was edited by: Jay Petrulis on 2002-11-25 12:30 ] |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Oct 2002
Location: Philadelphia 'Burbs
Posts: 937
|
This syntax should reflect what your intentions are, at least by my guess...
=IF(A1<=12,6000,IF(A1>12,(A1-12)*0.4+6000,"")) HTH /s/ Larry |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|