ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Combine an "IF" and "OR" statement (https://www.excelbanter.com/excel-worksheet-functions/215176-combine-if-statement.html)

Picman

Combine an "IF" and "OR" statement
 
I need to calculate the % difference between 2 years of sales, however one
year or the other may be a zero value (ie new customer this year or old one
last year that has no sales this year). Zero sales last year with sales this
year = 100% or sales last year with zero sales this year = -100%, or if there
are sales in both years calculate the % difference.

Roger Govier[_3_]

Combine an "IF" and "OR" statement
 
Hi

Assuming your data is in column A and B, In C1
=IF(COUNT(A1:B1)<2,"n/a",B1/A1*100)

This will put n/a in the cell if either (or both) year(s) has no value
Change the "n/a" to "" if you want a blank cell to appear.
--
Regards
Roger Govier

"Picman" wrote in message
...
I need to calculate the % difference between 2 years of sales, however one
year or the other may be a zero value (ie new customer this year or old
one
last year that has no sales this year). Zero sales last year with sales
this
year = 100% or sales last year with zero sales this year = -100%, or if
there
are sales in both years calculate the % difference.



Lars-Åke Aspelin[_2_]

Combine an "IF" and "OR" statement
 
On Fri, 2 Jan 2009 09:22:00 -0800, Picman
wrote:

I need to calculate the % difference between 2 years of sales, however one
year or the other may be a zero value (ie new customer this year or old one
last year that has no sales this year). Zero sales last year with sales this
year = 100% or sales last year with zero sales this year = -100%, or if there
are sales in both years calculate the % difference.


Last year in column A, this year in column B.

Try this formula in e.g. column C:

=IF(A1=0,100%,IF(B1=0,-100%,(B1-A1)/A1*100%))

Hope this helps / Lars-Åke


Shane Devenshire[_2_]

Combine an "IF" and "OR" statement
 
Hi,

If you will never have both years without sales, then try this

=IF(A1,(B1-A1)/A1,1)

Where A1 is the old year sale's and B1 the new year's sales

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Picman" wrote:

I need to calculate the % difference between 2 years of sales, however one
year or the other may be a zero value (ie new customer this year or old one
last year that has no sales this year). Zero sales last year with sales this
year = 100% or sales last year with zero sales this year = -100%, or if there
are sales in both years calculate the % difference.


Picman

Combine an "IF" and "OR" statement
 
That worked great, thank you very much.

"Lars-Ã…ke Aspelin" wrote:

On Fri, 2 Jan 2009 09:22:00 -0800, Picman
wrote:

I need to calculate the % difference between 2 years of sales, however one
year or the other may be a zero value (ie new customer this year or old one
last year that has no sales this year). Zero sales last year with sales this
year = 100% or sales last year with zero sales this year = -100%, or if there
are sales in both years calculate the % difference.


Last year in column A, this year in column B.

Try this formula in e.g. column C:

=IF(A1=0,100%,IF(B1=0,-100%,(B1-A1)/A1*100%))

Hope this helps / Lars-Ã…ke




All times are GMT +1. The time now is 06:59 PM.

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