![]() |
![]() |
|
|||||||
| 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: Mar 2002
Posts: 21
|
I have the following formula in cell F2
=IF(COUNTIF(A24:A28,E2),INDEX(D24:D28,MATCH(E2,A24:A28,0))*D2,0) And the following formula in Cell D2 =IF(B2="i",C2/2.5,IF(B2="d",C2/4,0)) The number that the above formula produces in D2 is 30. The formula in F2 is supposed take the number that is produced in D2 and come up with 2,370, which is the correct answer. But it comes up with the incorrect answer of 2401.60. If I remove the formula from D2 and just type in the number 30 it works correctly. Any ideas on why the formula in cell D2 affects the outcome? Thanks |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi JRRT
Are you sure the formula in D2 is really getting 30 and not 30.#### ? Try increasing the decimal places. |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 21
|
Yes, that is the problem is there a way to make it use the 30 instead of 30.4 that the formula produces.
|
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Yes, use the ROUND function.
=ROUND(30.4,0) |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
|
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Mar 2002
Posts: 21
|
The number in D2 will change is there a way to add it to the formula in D2 so that no matter wht number is in it it will round it? here is the formula. Thanks
=IF(B2="i",C2/2.5,IF(B2="d",C2/4,0)) |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
=ROUND(IF(B2="i",C2/2.5,IF(B2="d",C2/4,0)),0) or... =TRUNC(IF(B2="i",C2/2.5,IF(B2="d",C2/4,0))) ...depending on which one is more appropriate for your application. |
|
|
|
|
|
|
#8 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
=ROUND(IF(B2="i",C2/2.5,IF(B2="d",C2/4,0))
) Should work. |
|
|
|
|
|
#9 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Better make that...
=ROUND(IF(B2="i",C2/2.5,IF(B2="d",C2/4,0)),0) ROUND's 2nd argument is required! |
|
|
|
|
|
#10 |
|
New Member
Join Date: Mar 2002
Posts: 21
|
Thank you very much it works great!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|