# Calculate cells based on the range of one item code and at the same time exclude the first row of that item code, or if possible base the formula on the color of the cells

Hi,
I have a requirement to calculate the lowest price excluding zero, based on an inconsistent range of rows.  When calculating these rows I need to exclude the first row of each (grey row) from the range.   These scenarios as per the attached file, will occur in multiple workbooks.  I have to somehow calculate based on the range of one item code and at the same time exclude the first row of that item code, or if possible base the formula on the color of the cells.
Thanks
Example.xlsx
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Finance AnalystCommented:
It's not clear from your example what you are trying to achieve.

Which column(s)/row(s) are you trying to calculate?

As a simple check, you could add a helper column with this formula, starting at row 2 and copied down:

=B2=B1

This will give TRUE / FALSE as result, the first row of each set will be FALSE as they do not match the row above, you can then use the TRUE results as a criteria in your calculations.
0
Author Commented:
Thanks,

I am trying to calculate (in this example) cells range F2 to I2, F7 to I7 etc (the grey rows/blue columns)
If using a helper column, I don't know of a simple way of determining the range, could be 4 rows, could be 2 rows.

Cheers
0
Finance AnalystCommented:
If you are using the product ID as one of the criteria of SUMIF/MAXIF/MINIF etc then you don't need to specify your range; you can just use the whole range down to the last row and let the product ID criteria determine which rows it needs to look at.

For example, if you implement the TRUE/FALSE indicator as suggested in column J:

=SUMIFS(\$F\$1:\$F\$20,\$B\$1:\$B\$20,\$B2,\$J\$1:\$J\$20,TRUE)

That would only sum the TRUE from column J and the product ID in column B that match B2

Thanks
Rob H
0

Experts Exchange Solution brought to you by