Search code examples
excelexcel-formulaworksheet-function

Force '2.1' to be different from '2.10' (for SUMIF purposes)


I have a table. Column A has task numbers, column B has hours. The task numbers have the unfortunate format x.y, where x and y are numbers. This is not a format I have control over. So you can imagine something like:

 A         B
Task ID    Hours
2.1        8
2.1        8
3.5        9
2.1        7
1.3        3

I want to have a summary table that adds all the hours for each task. Simple:

=sumif(A:A, C1, B:B) 

I have a problem though. If C1 contains the value '2.10' (the 10th subtask of task 2), then, with the above table, I get 23, even though there are no '2.10' values in column A.

I've tried "Format Cell" as text for both column A and cell C1. I tried putting a ' in front of both C1 and every single value of column A. I've tried having another column that was basically =A1 & "" and do the SUMIF on that. I'm at a loss here.

How can I force Excel to consider 2.1 and 2.10 as different values for the SUMIF?


Solution

  • SUMPRODUCT() will be more helpful to you. In this example column A and cell C1 are formatted as Text

    enter image description here