Hi all,
i wish to add the sum of 2 coulmns, however on some occasions some cells may contain text, in some instances both cells may contain text, is there a formula to get around this problem.
thanks
steviegee
Try
=if(and(istext(a1),istext(b1)),0,if(istext(a1),b1,if(istext(b1),a1,a1+b1)))
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Genius,
Many thanks,
thats solved the situation nicely.
Thanks for the tips, and i will read them.
regards
steviegee
Why not just use SUM ?
=SUM(A1:B1)
Non-numerics are simply ignored and the ranges need not be contiguous, ie:
=SUM(A1:B1,D1,Z10:AA12,AD1)
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Both formulas do the job,
however how can i get rid of the "false" errors if there is no values or text in the cells?
Thanks
Use SUM - it will simply return 0.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
I understand what your saying, but i do need the cells that have no values or text to return a blank anwser,they a1&b1 will have no text or values, it will not just be 1 cell that has a value or text.
basically it will be a block of data, then scroll down to find the next block of data.
hope your understanding me.
steviegee
No, I'm afraid I don't follow...
If you want a Null
=IF(COUNT(A1:B1),SUM(A1:B1),"")
Alternatively if the SUM of A1:B1 will never genuinely be 0 then you can use SUM as before but apply a Custom Format on the cells containing the formulae of: General;;
As such 0's display as Blanks.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Problem solved.
Perfect.
Many thanks
Steviegee
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks