ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If cell contains text, leave as is (https://www.excelbanter.com/excel-programming/364296-if-cell-contains-text-leave.html)

[email protected]

If cell contains text, leave as is
 
Trying to create a formula that will sum 5 cells to the right of the
cell in question if the cell the cell in question contains a Numerical
value, and that will do nothing if the cell in question contains text.

I have gotten as far as:

IF(TYPE(1), SUM(C6513:M6513), "")

Obviously, "" does not return the same text originally in the cell, but
instead a 0.


Tom Ogilvy

If cell contains text, leave as is
 
the cell in question has to contain a value or a formula (or be blank). If
it contains a formula, then it is unclear where you are testing.

Instead of saying Cell in question, say

if A1 contains text then in cell B6513 display "" else display
SUM(C6513:M6513),

=if(istext(A1),"",SUM(C6513:M6513))

as an example.

--
Regards,
Tom Ogilvy



" wrote:

Trying to create a formula that will sum 5 cells to the right of the
cell in question if the cell the cell in question contains a Numerical
value, and that will do nothing if the cell in question contains text.

I have gotten as far as:

IF(TYPE(1), SUM(C6513:M6513), "")

Obviously, "" does not return the same text originally in the cell, but
instead a 0.



[email protected]

If cell contains text, leave as is
 
Ok, let me reword

This is what I have:

=IF(N7279=TYPE(1),SUM(C7279:M7279), N7279)

In cell O7279

There are two more adjustments needed. If cell N7279 is blank(no value
or formula) then O7279 should be blank. Also is there a way to copy
the formatting from cell N7279 to O7279 in the same formula?


Tom Ogilvy

If cell contains text, leave as is
 
=type(1)

always returns 1 since the argument you provided (1) is a number


=If(N7279="","",IF(type(N7279)=2,"",If(type(N7279) =1,SUM(C7279:M7279),"")))

--
Regards,
Tom Ogilvy


" wrote:

Ok, let me reword

This is what I have:

=IF(N7279=TYPE(1),SUM(C7279:M7279), N7279)

In cell O7279

There are two more adjustments needed. If cell N7279 is blank(no value
or formula) then O7279 should be blank. Also is there a way to copy
the formatting from cell N7279 to O7279 in the same formula?




All times are GMT +1. The time now is 08:31 PM.

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