Something like this should suffice:
=IF(COUNTA(C2:G2)-COUNT(C2:G2)>0,"",E2)
COUNTA returns number of cells with something in them, COUNT returns number of cells with numbers. Thus, the difference between two is the number of cells with text.
Certainly. That's actually easier:
=IF(COUNTIF(C2:G2,"Absent")>0,"Absent",E2)
Actually, I was wondering if it is possible to sum a range as we usually do, but if any of the cell contains a certain text, the formula should return that text, like in the above example it has returned "Absent" but when there are numbers in whole range it should sum.
Hi,
Try below formula:
=IF(COUNT(A1:E1)=COUNTA(A1:E1),SUM(A1:E1),"TEXT")
Suppose A1:E1 has numbers or text.
Regards,
COUNT function counts numbers in the range and COUNTA counts anything. SO if count of numbers is equal to count of anything it will give the sum and if count of numbers is not equal to count of everything it will result in TEXT.Thanks @Somendra Misra, you simply nailed it. I was trying so hard but failed in doing this. Can you please explain how come COUNT & COUNTA function is giving the desired result?