Re: If Or Statements
Hi,
Your formulas a bit on the long side but should still work. A couple of reasons why it currently doesn't work:
1. You are including cells in columns A & B in your formula. These columns are used for an employee number and name and shouldn't be in a formula that sums the total number of hours worked for a week.
E.g. From your example, the first condition checks to see if cell A8 > 8 (it is 545 in the example provided so the answer is true). You then go on to say that if A8 >8 then add 8 to the total. This is an employee number and nothing to do with hours worked so gives a skewed answer to your formula. Same thing applies to cell B8
2. Your formula misses out column G (cell G8 in your example). This is the hours worked for Friday - it looks like you should be including this in the total unless Friday's are when you put your feet up...
3. The formulas where you check to see if a cell contains text is actually correct. However, the way you've set out the formula in general means that a cell containing text will return 0.
E.g. From your example, when looking at cell C8, the formula checks to see if the value is > 8 (H is deemed to be > 8 in this case!) so a value of 8 is returned. However, you then subtract 8 if the cell contains text (which it does) so you arrive back at the answer of 0.
The reason you are arriving at a result of 24 in cell K8 is as follows:
Cell A8 > 8 so add 8 to total
Cell B8 > 8 but is also text so add 0 to total
Cell C8 > 8 but is also text so add 0 to total
Cell D8 >8 but is also text so add 0 to total
Cell E8 = 8 so add 8 to total
Cell F8 = 8 so add 8 to total
Cell G8 is not in the formula so not in total
Total = 24 (per cell K8)
You can see from the above that the problem is nothing to do with Excel not reading the H as text.
Okay, after all my rambling, the answer to your question is:
=IF(ISTEXT(C8),8,IF(C8>8,8,C8))+IF(ISTEXT(D8),8,IF(D8>8,8,D8))+IF(ISTEXT(E8),8,IF(E8>8,8,E8))+IF(ISTEXT(F8),8,IF(F8>8,8,F8))+IF(ISTEXT(G8),8,IF(G8>8,8,G8))
Should go in cell K8.
B
