Thema Datum  Von Nutzer Rating
Antwort
05.12.2018 08:14:46 Newbie
NotSolved
05.12.2018 08:57:38 Gast43378
NotSolved
05.12.2018 09:00:09 Gast19274
NotSolved
05.12.2018 13:54:29 Gast57935
NotSolved
06.12.2018 07:22:46 Newbie
NotSolved
05.12.2018 13:52:17 Gast47274
NotSolved
05.12.2018 13:52:39 Gast9795
NotSolved
Blau mit Makro
05.12.2018 19:15:42 ugor
NotSolved
06.12.2018 07:42:41 Gast67673
NotSolved
06.12.2018 11:55:10 ugpr
NotSolved
07.12.2018 08:44:59 Gast81396
NotSolved
07.12.2018 13:31:22 ugor
NotSolved

Ansicht des Beitrags:
Von:
ugor
Datum:
05.12.2018 19:15:42
Views:
475
Rating: Antwort:
  Ja
Thema:
mit Makro

Hallo,

hier mein Vorschlag. Du hast auf das Herberforum verlinkt, hast du dort auch gefragt und hast du dort eine Antwort bekommen?

Sub Beispiel()
Dim ergebnis
ergebnis = zweiD(Tabelle1.Range("A4:B7"), Tabelle1.Range("D4:E12"))
Tabelle1.Range("J18").Resize(UBound(ergebnis), 3) = ergebnis
End Sub

Function zweiD(bb As Range, aa As Range)        'bitte gib der Funktion einen besseren Namen
Dim a, b, c
Dim ia As Long, ib As Long, ic As Long, nc As Long
'Daten aus den Ranges in Arrays
a = aa.Value
b = bb.Value

'Neues Array für alle Daten (transponiert wegen redim preserve)
ReDim c(1 To 3, 1 To UBound(a) + UBound(b))
For ic = 1 To UBound(c, 2):  c(3, ic) = -100000:      Next

'Werte in Array c verteilen
ia = 1
ib = 1
ic = 0

Do
    Do While a(ia, 1) <= b(ib, 1)
        ic = ic + 1
        c(1, ic) = a(ia, 1)
        c(2, ic) = a(ia, 2)
        ia = ia + 1
        If ia > UBound(a, 1) Then Exit Do
    Loop
    If ic > 0 Then
    If b(ib, 1) = c(1, ic) Then
        c(3, ic) = b(ib, 2)
        ib = ib + 1
    End If
    End If
    If ia > UBound(a, 1) Or ib > UBound(b, 1) Then Exit Do

    Do While b(ib, 1) <= a(ia, 1)
        ic = ic + 1
        c(1, ic) = b(ib, 1)
        c(3, ic) = b(ib, 2)
        ib = ib + 1
        If ib > UBound(b, 1) Then Exit Do
    Loop
    If a(ia, 1) = c(1, ic) Then
        c(2, ic) = a(ia, 2)
        ia = ia + 1
    End If
    If ia > UBound(a, 1) Or ib > UBound(b, 1) Then Exit Do
Loop


Do While ia <= UBound(a, 1)
    ic = ic + 1
    c(1, ic) = a(ia, 1)
    c(2, ic) = a(ia, 2)
    ia = ia + 1
Loop

Do While ib <= UBound(b, 1)
    ic = ic + 1
    c(1, ic) = b(ib, 1)
    c(3, ic) = b(ib, 2)
    ib = ib + 1
Loop

nc = ic                                 'Zeilenanzahl
ReDim Preserve c(1 To 3, 1 To nc)       'gestutzt



'lin. Interpolation in den Lücken von c(3,*), mit nicht äquidistanten x-Werten c(1,*)
ia = 1
Do While c(3, ia) = -100000:    ia = ia + 1:   Loop     'keinen Extrapolation am Anfang
Do
    If c(3, ia) = -100000 Then
        ia = ia - 1
        ib = ia + 1
        Do While c(3, ib) = -100000
            ib = ib + 1
            If ib > UBound(c, 2) Then  'Extrapolation am Ende
                ib = ia - 1
                Exit Do
            End If
        Loop
        For ic = ia + 1 To IIf(ib < ia, nc, ib - 1)
            c(3, ic) = c(3, ia) + (c(3, ib) - c(3, ia)) / (c(1, ib) - c(1, ia)) * (c(1, ic) - c(1, ia))
        Next
        ia = ic - 1
    End If
    ia = ia + 1
Loop While ia < nc

zweiD = Application.Transpose(c)
End Function

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
05.12.2018 08:14:46 Newbie
NotSolved
05.12.2018 08:57:38 Gast43378
NotSolved
05.12.2018 09:00:09 Gast19274
NotSolved
05.12.2018 13:54:29 Gast57935
NotSolved
06.12.2018 07:22:46 Newbie
NotSolved
05.12.2018 13:52:17 Gast47274
NotSolved
05.12.2018 13:52:39 Gast9795
NotSolved
Blau mit Makro
05.12.2018 19:15:42 ugor
NotSolved
06.12.2018 07:42:41 Gast67673
NotSolved
06.12.2018 11:55:10 ugpr
NotSolved
07.12.2018 08:44:59 Gast81396
NotSolved
07.12.2018 13:31:22 ugor
NotSolved