ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range (https://www.excelbanter.com/excel-programming/371631-range.html)

Howard

Range
 
I have this formula:

-- If IsEmpty(Range(d9) Then
Range (e11").Formula = =(e5:e8)/4
End If

I want to insert the Else statement to do this:

If d8 and d9 are both empty then (e5:e7)/3

How do I do it?
Thanks,
Howard


Howard

Die_Another_Day

Range
 
If IsEmpty(Range("D8:D9")) Then
Range("E11").Formula = "=(E5:E7)/3"
ElseIf IsEmpty(Range("d9") Then
Range ("e11").Formula = "=(e5:e8)/4"
End If

Charles Chickering
Howard wrote:
I have this formula:

-- If IsEmpty(Range("d9") Then
Range ("e11").Formula = "=(e5:e8)/4"
End If

I want to insert the Else statement to do this:

If d8 and d9 are both empty then (e5:e7)/3

How do I do it?
Thanks,
Howard


Howard



Dave Peterson

Range
 
isempty() won't work like you want with multiple cells.

Either

if isempty(range("D8").value) _
and isempty(range("d9").value) then
'both empty

or

if application.counta(range("d8:d9")) = 0 then
'both empty



Die_Another_Day wrote:

If IsEmpty(Range("D8:D9")) Then
Range("E11").Formula = "=(E5:E7)/3"
ElseIf IsEmpty(Range("d9") Then
Range ("e11").Formula = "=(e5:e8)/4"
End If

Charles Chickering
Howard wrote:
I have this formula:

-- If IsEmpty(Range("d9") Then
Range ("e11").Formula = "=(e5:e8)/4"
End If

I want to insert the Else statement to do this:

If d8 and d9 are both empty then (e5:e7)/3

How do I do it?
Thanks,
Howard


Howard


--

Dave Peterson

Howard

Range
 
Thanks, Dave.

That will do it!
--
Howard


"Dave Peterson" wrote:

isempty() won't work like you want with multiple cells.

Either

if isempty(range("D8").value) _
and isempty(range("d9").value) then
'both empty

or

if application.counta(range("d8:d9")) = 0 then
'both empty



Die_Another_Day wrote:

If IsEmpty(Range("D8:D9")) Then
Range("E11").Formula = "=(E5:E7)/3"
ElseIf IsEmpty(Range("d9") Then
Range ("e11").Formula = "=(e5:e8)/4"
End If

Charles Chickering
Howard wrote:
I have this formula:

-- If IsEmpty(Range("d9") Then
Range ("e11").Formula = "=(e5:e8)/4"
End If

I want to insert the Else statement to do this:

If d8 and d9 are both empty then (e5:e7)/3

How do I do it?
Thanks,
Howard


Howard


--

Dave Peterson



All times are GMT +1. The time now is 06:34 AM.

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