ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   =SUM Then insert word. (https://www.excelbanter.com/excel-worksheet-functions/5416-%3Dsum-then-insert-word.html)

iwgunter

=SUM Then insert word.
 

I need a, in my book, complex function:


Code:
--------------------
=SUM C2-B2
IF < 0 { } ELSE IF == 0 { 0 Days } ELSE IF == 1 { 1 Day } ELSE IF = 2 { * Days }
--------------------


This is probably written all wrong, but I'm used to writing in PHP, not
Excel Functions.

Basically IF result is less than 0 leave cell empty, IF result is 1
enter "1 Day", IF result is greater or equal to 2 enter "[result]
Days".


Many Thanks
Ian Gunter


--
iwgunter
------------------------------------------------------------------------
iwgunter's Profile: http://www.excelforum.com/member.php...o&userid=15441
View this thread: http://www.excelforum.com/showthread...hreadid=274111


Alex Delamain


This should do it

=IF(C2-B2<=0,"",IF(C2-B2=1,"1 day",+C2-B2&" Days"))


--
Alex Delamain
------------------------------------------------------------------------
Alex Delamain's Profile: http://www.excelforum.com/member.php...o&userid=11273
View this thread: http://www.excelforum.com/showthread...hreadid=274111


Arvi Laanemets

Hi

=IF(OR(C2="",B2="",C2-B2<0),"",(C2-B2) & " Day" & IF(C2-B2=1,"","s")))


--
Arvi Laanemets
(When sending e-mail, use address arvil<Attarkon.ee)


"iwgunter" wrote in message
...

I need a, in my book, complex function:


Code:
--------------------
=SUM C2-B2
IF < 0 { } ELSE IF == 0 { 0 Days } ELSE IF == 1 { 1 Day } ELSE IF = 2

{ * Days }
--------------------


This is probably written all wrong, but I'm used to writing in PHP, not
Excel Functions.

Basically IF result is less than 0 leave cell empty, IF result is 1
enter "1 Day", IF result is greater or equal to 2 enter "[result]
Days".


Many Thanks
Ian Gunter


--
iwgunter
------------------------------------------------------------------------
iwgunter's Profile:

http://www.excelforum.com/member.php...o&userid=15441
View this thread: http://www.excelforum.com/showthread...hreadid=274111




mzehr

Hi,
Try
=IF(C2-B2=0,"",IF(C2-B2=1,"1 DAY",IF(C2-B2= 2, C2-B2 & " Days","N/A")))



"iwgunter" wrote:


I need a, in my book, complex function:


Code:
--------------------
=SUM C2-B2
IF < 0 { } ELSE IF == 0 { 0 Days } ELSE IF == 1 { 1 Day } ELSE IF = 2 { * Days }
--------------------


This is probably written all wrong, but I'm used to writing in PHP, not
Excel Functions.

Basically IF result is less than 0 leave cell empty, IF result is 1
enter "1 Day", IF result is greater or equal to 2 enter "[result]
Days".


Many Thanks
Ian Gunter


--
iwgunter
------------------------------------------------------------------------
iwgunter's Profile: http://www.excelforum.com/member.php...o&userid=15441
View this thread: http://www.excelforum.com/showthread...hreadid=274111




All times are GMT +1. The time now is 02:56 PM.

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