Maybe with a UDF:
Function Tot(Descriptions As Range, Costs As Range)
Dim cell As Range
If Descriptions.Columns.Count 1 Or _
Costs.Columns.Count 1 Then
Tot = CVErr(xlErrRef)
ElseIf Descriptions.Rows.Count < Costs.Rows.Count Then
Tot = CVErr(xlErrNA)
Else
For Each cell In Costs
If cell.Value < 0 Then
Tot = Tot & cell.Offset(0, -1).Value & _
"=$" & cell.Value & ", "
End If
Next cell
Tot = "Detail: " & Tot & "Total=$" & Application. _
WorksheetFunction.Sum(Costs)
End If
End Function
Enter in a cell = tot(A1:A5,B1:B5) where column A has the descriptions
and column B the costs.
Hope this helps
Rowan
b w wrote:
Thanks for the reply.
I'm trying to do this in-cell, but your solution indicates that I didn't
explain myself very well.
If B1 is zero, then your expression works, but I want to do this for ALL
B cells that are zero. An IF statement wouldn't be too practical if I
were looking at more than a few values of B.
As an example, If B1 and B2 and B3 are NOT zero, then my equation would
be =(A1 & B1) & (A2 & B2) & (A3 & B3).
But if B2 was Zero, then the equation would be:
=(A1 & B1) & (A3 & B3).
I was thinking that maybe an Array Formula would be the solution, but I
don't know, which is why I have posed the problem.
Thanks,
Bernie
*** Sent via Developersdex http://www.developersdex.com ***