mercredi 27 novembre 2019

IF all cells in a range are the same, excluding blank cells

I have a table to calculate the price of a project, where one column is the description of an element of the project followed by a column for its unit (usually hours), the price per unit, number of units, and the final price, sort of like this: enter image description here

My question really only involves the highlighted cells. Im making a template, and I add elements to the table as I go along, so some rows are left blank, but I want the total number of hours to be displayed in D7 (easy enough, =SUM(D2:D6)), but my problem is that some of the elements aren't written per hour (eg. row 4), so I want the total to only show up if all the values are for hours. Essentially:

IF all values in row B are "Hours", then sum of row D, else "")

I guess in short, is there a formula I can use that would return TRUE if all the values in a range are the same, excluding blank cells?

Thanks.

Aucun commentaire:

Enregistrer un commentaire