Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RaY RaY is offline
external usenet poster
 
Posts: 164
Default Simplifying IF Statement

I would like to simplify (reduce) the number of IF statements in this
formula: -
=IF(H901,G90*M90*P90,IF(I901,G90*M90*P90,IF(J90 1,G90*M90*P90,IF(K901,G90*M90*P90,IF(L901,G90*M9 0*P90,(G90*7850*(N90/1000*O90/1000*Q90)))))))

Without a Macro, as there is already macros operating elsewhere in the
spreadsheet. I was thinking of something like:

=IF(H90:L901,G90*M90*P90,,(G90*7850*(N90/1000*O90/1000*Q90)), but this
returns a #VALUE error.

Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Simplifying IF Statement

Please post future worksheet formula questions to the worksheet.functions
group.

To answer your question, here are two options:

If you need to check each cell value individually, use an OR statement:

IF(or(H901, I901, J901, K901, L901), G90*M90*P90,
(G90*7850*(N90/1000*O90/1000*Q90)))

I don't know anything about your data, but if those 5 cells will have a
value of 1 by default (instead of potentially zero) you could also just sum
them and look for a value greater than 5, which by default means that one of
them has to be 1:

If (sum(H90:L90)5, ), G90*M90*P90, (G90*7850*(N90/1000*O90/1000*Q90)))

HTH,
Keith

"Ray" wrote:

I would like to simplify (reduce) the number of IF statements in this
formula: -
=IF(H901,G90*M90*P90,IF(I901,G90*M90*P90,IF(J90 1,G90*M90*P90,IF(K901,G90*M90*P90,IF(L901,G90*M9 0*P90,(G90*7850*(N90/1000*O90/1000*Q90)))))))

Without a Macro, as there is already macros operating elsewhere in the
spreadsheet. I was thinking of something like:

=IF(H90:L901,G90*M90*P90,,(G90*7850*(N90/1000*O90/1000*Q90)), but this
returns a #VALUE error.

Can anyone help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Simplifying IF Statement

It's late in my day, so my analytical cells may be sleeping, but it looks to
me like the "OR" in Keith's suggested formula should be an "AND". But his
other idea is definitely simpler if the assumptions are correct.

"ker_01" wrote:

Please post future worksheet formula questions to the worksheet.functions
group.

To answer your question, here are two options:

If you need to check each cell value individually, use an OR statement:

IF(or(H901, I901, J901, K901, L901), G90*M90*P90,
(G90*7850*(N90/1000*O90/1000*Q90)))

I don't know anything about your data, but if those 5 cells will have a
value of 1 by default (instead of potentially zero) you could also just sum
them and look for a value greater than 5, which by default means that one of
them has to be 1:

If (sum(H90:L90)5, ), G90*M90*P90, (G90*7850*(N90/1000*O90/1000*Q90)))

HTH,
Keith

"Ray" wrote:

I would like to simplify (reduce) the number of IF statements in this
formula: -
=IF(H901,G90*M90*P90,IF(I901,G90*M90*P90,IF(J90 1,G90*M90*P90,IF(K901,G90*M90*P90,IF(L901,G90*M9 0*P90,(G90*7850*(N90/1000*O90/1000*Q90)))))))

Without a Macro, as there is already macros operating elsewhere in the
spreadsheet. I was thinking of something like:

=IF(H90:L901,G90*M90*P90,,(G90*7850*(N90/1000*O90/1000*Q90)), but this
returns a #VALUE error.

Can anyone help?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Simplifying IF Statement

Another way using COUNTIF()

=IF(COUNTIF(H90:L90,"1"),true statement,falsestatement)

=IF(COUNTIF(H90:L90,"1"),G90*M90*P90,G90*7850*(N9 0/1000*O90/1000*Q90)

If this post helps click Yes
---------------
Jacob Skaria


"Ray" wrote:

I would like to simplify (reduce) the number of IF statements in this
formula: -
=IF(H901,G90*M90*P90,IF(I901,G90*M90*P90,IF(J90 1,G90*M90*P90,IF(K901,G90*M90*P90,IF(L901,G90*M9 0*P90,(G90*7850*(N90/1000*O90/1000*Q90)))))))

Without a Macro, as there is already macros operating elsewhere in the
spreadsheet. I was thinking of something like:

=IF(H90:L901,G90*M90*P90,,(G90*7850*(N90/1000*O90/1000*Q90)), but this
returns a #VALUE error.

Can anyone help?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code needs simplifying Sandy Excel Worksheet Functions 5 April 26th 07 01:31 PM
Simplifying VBA code Michael M Excel Worksheet Functions 8 January 24th 07 02:17 PM
Simplifying a formula MartinW Excel Worksheet Functions 3 June 19th 06 11:50 AM
Simplifying formula m.cain Excel Discussion (Misc queries) 1 March 24th 06 11:35 AM
Simplifying VBA code Steve[_71_] Excel Programming 7 November 2nd 04 07:44 PM


All times are GMT +1. The time now is 04:15 AM.

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

About Us

"It's about Microsoft Excel"