ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If Function (https://www.excelbanter.com/excel-discussion-misc-queries/168000-if-function.html)

Micki

If Function
 
In cell L8 is the number-3 and in cell M8 is the number -7. The numbers
represent results of a countif formula. In cell M12, I want to sum specific
cells if the L8 and M8 values are equal and if they are not equal, I want to
sum the same cells and subtract L8 and add M8.
The formula I have is:
=IF(M8=L8,M11+SUM(M2:M7),SUM(M2:M7-L8+M8))

I'm getting a #VALUE! error. Any help would be appreciated.

Jim Thomlinson

If Function
 
your sum function can not handle the - operator inside it. Try this...

=IF(M8=L8,M11+SUM(M2:M7),SUM(M2:M7)-(L8+M8))

--
HTH...

Jim Thomlinson


"Micki" wrote:

In cell L8 is the number-3 and in cell M8 is the number -7. The numbers
represent results of a countif formula. In cell M12, I want to sum specific
cells if the L8 and M8 values are equal and if they are not equal, I want to
sum the same cells and subtract L8 and add M8.
The formula I have is:
=IF(M8=L8,M11+SUM(M2:M7),SUM(M2:M7-L8+M8))

I'm getting a #VALUE! error. Any help would be appreciated.


BoniM

If Function
 
Your formula is fine, as long as your range (M2:M7) contains values. What
data do you have in this range?

"Micki" wrote:

In cell L8 is the number-3 and in cell M8 is the number -7. The numbers
represent results of a countif formula. In cell M12, I want to sum specific
cells if the L8 and M8 values are equal and if they are not equal, I want to
sum the same cells and subtract L8 and add M8.
The formula I have is:
=IF(M8=L8,M11+SUM(M2:M7),SUM(M2:M7-L8+M8))

I'm getting a #VALUE! error. Any help would be appreciated.


Micki

If Function
 
I hate syntax. Thanks Jim. And thank you too BoniM.

"Jim Thomlinson" wrote:

your sum function can not handle the - operator inside it. Try this...

=IF(M8=L8,M11+SUM(M2:M7),SUM(M2:M7)-(L8+M8))

--
HTH...

Jim Thomlinson


"Micki" wrote:

In cell L8 is the number-3 and in cell M8 is the number -7. The numbers
represent results of a countif formula. In cell M12, I want to sum specific
cells if the L8 and M8 values are equal and if they are not equal, I want to
sum the same cells and subtract L8 and add M8.
The formula I have is:
=IF(M8=L8,M11+SUM(M2:M7),SUM(M2:M7-L8+M8))

I'm getting a #VALUE! error. Any help would be appreciated.



All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com