View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Need another formula

"Lee" wrote:
Ok, I'm using the formula =SUMIF(B1,"=X",A1) to show
the value of cell A1 only if cell B1 has an "X".


First, why would you use SUMIF() for this purpose? That's
like "killing an ant with a sledgehammer". Why not simply
one of the following?

=if(B1 = "X", A1, 0)
=(B1 = "X")*A1

I want to include the value of 2 other cells along with cell
A1 but only if cell B1 has the "X".


Will one of the following fit the bill?

=if(B1 = "X", sum(A1:A3), 0)
=if(B1 = "X", A1+A3+A5, 0)
=(B1 = "X")*sum(A1:A3)
=(B1 = "X")*(A1+A3+A5)