SUMIF

S

Sam G

I am trying to create a formula to sum across a row with the following:

If any of the cells contain the text "ILL" and the number value is equal to
8 or less than 8 sum. Any ideas?
 
G

Glenn

Sam said:
I am trying to create a formula to sum across a row with the following:

If any of the cells contain the text "ILL" and the number value is equal to
8 or less than 8 sum. Any ideas?


Give some examples of the values you expect to find in your row and the results
you want.
 
D

David Biddulph

But if the cell content is "ill", it won't have a number value, will it?
Won't that give a #VALUE! error if any cell in the range contains "ill"?
 
S

Sam G

Don Guillett said:
=sumproduct((a2:f2="ill")*(a2:f2<=8)*a2:f2)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)


Thanks Don.. David is correct it returned a #value error. Let me try again. What I am trying to accomplishis, let's say I have 31 cells on the same row that contain the following; I'll just use 3 cells for the example. cell A1="ILL 8" cell B1= "ILL 6.2" and cell C1 has "ILL 8". If these were totaled there would be 22.2 "ILL". That's what I am trying to do account for ill hours thoughout any given month.
 
S

Sam G

Eduardo,

Yes the numbers and ILL are on the same row, actually in the same cell.
Cell A1 = ILL 8 and Cell B1=ILL 6.2 and so on for the whole month. I am
trying to get all cells in the row totaled.

Thanks

Sam
 
G

Glenn

Array formula (commit with CTRL+SHIFT+ENTER):

=SUM(IF(LEFT(A1:AE1,3)="ILL",
IF(--MID(A1:AE1,FIND(" ",A1:AE1)+1,LEN(A1:AE1))<=8,
--MID(A1:AE1,FIND(" ",A1:AE1)+1,LEN(A1:AE1)))))
 
J

Jacob Skaria

Please note that this is an array formula. An array formula can perform
multiple calculations and then return either a single result or multiple
results. Array formulas act on two or more sets of values known as array
arguments. Each array argument must have the same number of rows and columns.
You create array formulas in the same way that you create other formulas,
except you press CTRL+SHIFT+ENTER to enter the formula. If successful in
'Formula Bar' you can notice the curly braces at both ends like "{=<formula>}"

=SUM(IF(LEFT(A1:A20,3)="ill",IF(--SUBSTITUTE(A1:A20,"ILL",)<=8,--SUBSTITUTE(A1:A20,"ILL",))))

If this post helps click Yes
 
D

Don Guillett

When posting you should always present the full question. Try this macro for
row 1

Sub sumproducttextwithvalue()
Dim ms As Long
dim i as long
dim ms as double
On Error Resume Next
For i = 1 To Cells(1, Columns.Count).End(xlToLeft).Column
If LCase(Left(Cells(1, i), 3)) = "ill" Then
ms = ms + Mid(Cells(1, i), 4, 5)
End If
Next i
MsgBox Format(ms, "00.00")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top