Sure, with the array formula I gave you. This assumes of course that the logic
holds good in that as per your example every numeric value is in a similar
offset position to the cell containing REG being evaluated, ie all your numbers
were consistent in being one cell to the right of the cell with REG in. In that
scenario you could just extend the formula
=SUM(IF(ISERROR((B4:F4="REG")*(C4:G4)),0,(B4:F4="REG")*(C4:G4)))
to
=SUM(IF(ISERROR((B4:AY4="REG")*(C4:AZ4)),0,(B4:AY4="REG")*(C4:AZ4)))
The ranges must be the same length, and although in this case they are offset by
one column, they are still the same length. It efefectively sets up a series of
TRUE/FALSE statements for each cell in the range B4:AY4 depending on whether or
not each cell contains REG. This gives
B C D E F G
4 TRUE FALSE TRUE FALSE TRUE FALSE
and then multiplies that range by the same range one cell to the right (Excel
sees TRUE = 1, FALSE = 0)
so you get a series of TRUE*Number + TRUE*Number + TRUE*Number (Or FALSE if not
equal to REG)
which = 1*Number + 1*Number + 1*Number
which = Number + Number + Number etc
The reason for the range being offset by one column, is that Excel will multiply
the first value in the first range by the first value in the second range,
regardless of what columns they start in.
--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03
----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission

----------------------------------------------------------------------------
Howard said:
If ALL three cells (A4,C4,E4) contain "REG", then sum B4,D4,F4. If I had many
cells that I wanted to test (A4,C4,E4 and so on out to AZ4), is there a way not
to have to write A4="REG", C4="REG"......AZ4="REG"?