yes calculatio nis set to automatic!
for the function, here it is :
Function LIVRAISONS(date_debut As Range, lignes As Range, type_cam As Range, dates_livr As Range) As Double
Dim tabl() As String
Dim i As Integer
Dim rng As Range
Dim result As Double
result = 0
tabl = Split(lignes, "/")
Set rng = Range(tabl(0))
If UBound(tabl) >= 1 Then
For i = 1 To UBound(tabl)
Set rng = Application.Union(rng, Range(tabl(i)))
Next i
End If
For Each c In Intersect(rng, type_cam)
If Not (c.Value = "" Or c.Value = 0) Then
For Each cell In Intersect(Rows(c.Row), dates_livr)
If Not (cell.Value = "" Or cell.Value = 0) = True And date_debut <= cell.Value And date_debut + 6 >= cell.Value Then
result = result + c.Value
End If
Next cell
End If
Next c
LIVRAISONS = result
End Function
date_debut contains a date
lignes contains a string like that :
173:173,196:196,209:209,212:212,214:214/237:237,250:250,253:253,255:255,278:278,291:291,294:294,296:296
type_cam is a range of cells in column (an entire column) cotainning integers
dates_livr is a range of cells (multiple rows and columns) containing dates
if you have any question, go for it, i know my function is dirty coded :/ and in french so it doesn't help to find the problem for you
Bookmarks