Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

SUM IF STATEMENT

0

TRYING TO SUM D4:N4 BUT SOMETIMES I HAVE CODED THE CELL TO SHOW NOT ONLY NUMBERS BUT ALSO OVERTIME NUMBERS ("8/1").  CURRENTLY, AM USING THIS FORMULA: 

=SUM(IF(MID(D4,2,1)="/",LEFT(D4,1),D4),SUM(IF(MID(E4,2,1)="/",LEFT(E4,1),E4),SUM(IF(MID(F4,2,1)="/",LEFT(F4,1),F4),SUM(IF(MID(G4,2,1)="/",LEFT(G4,1),G4),SUM(IF(MID(H4,2,1)="/",LEFT(H4,1),H4),SUM(IF(MID(I4,2,1)="/",LEFT(I4,1),I4),SUM(IF(MID(J4,2,1)="/",LEFT(J4,1),J4),SUM(IF(MID(K4,2,1)="/",LEFT(K4,1),K4),SUM(IF(MID(L4,2,1)="/",LEFT(L4,1),L4),SUM(IF(MID(M4,2,1)="/",LEFT(M4,1),M4),SUM(IF(MID(N4,2,1)="/",LEFT(N4,1),N4))))))))))))

MY PROBLEM IS THAT IT ONLY WORKS WITH WHOLE NUMBERS.  IF I HAVE (7.5/1.5) IT DOES NOT READ THAT AS SUCH. I AM SUMMING THIS RANGE TO TWO DIFFERENT FIELDS:  REG (FOR REGULAR TIME) AND OT (FOR OVERTIME).

THE REASON AM SPANNING THIS RANGE IS WE ARE TRYING TO SHOW WHICH JOBS RECEIVED HOW MANY HOURS OF WORK.

Answer
Discuss

Discussion

Please don'e use ALL CAPS in your posts!
don (rep: 1989) Apr 27, '19 at 7:26 am
Add to Discussion

Answers

0
Selected Answer

Here is a simple solution:

  • add a helper column that is an actual number and make it have a formula that computes the result of the fraction if it was not stored as text.
  • use that helper column for the SUMIF() or SUMIFS() function
  • hide the helper column by right-clicking the column header and hiding it, if you don't want the user to know it exists.

This is a pretty standard way of making more complex situations in Excel easier to handle.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login