Help!! Index-Match disertai Penjumlahan + Perkalian + Pembagian

  1. 4 tahun lalu

    Assalamualaikum , Siang ..
    Mau tanya ,

    1. Cara membuat Macro Penjumlahan + Perkalian dalam satu cell
    2. Saya membuat code index- match , tapi di hasil macro muncul rumusnya , apakah bisa di hidden / dihilangkan

    Terima kasih

  2. @Chris212

    sepertinya pertanyaan anda sulit dipahami, mungkin bisa coba dijelaskan lebih baik lagi apa yang anda tanyakan, akan lebih baik jika di sertakan contoh file kasusnya dan contoh hasil yang diharapkan

  3. @manweljs_
    Maaf , file belum terupload
    Saya sudah membuat macro index match , pertanyaan saya ;

    1. saya ingin membuat rumus macro Penjumlahan + perkalian secara bersaman
    2. hasil macro saya di bar formula muncul rumusnya , saya mau di hasil formula tidak terlihat rumusnya

    Terima kasih

  4. Di sunting 4 tahun lalu oleh manweljs_

    @Chris212

    caranya bisa bermacam2, salah satu contoh skripnya :

    Sub FindValue()
    Dim x As Long, y As Long, r As Long, xSh As Worksheet, ySh As Worksheet
    Set xSh = Worksheets("HARGA")
    Set ySh = Worksheets("DATA")
    
        x = xSh.Cells(Rows.Count, "B").End(xlUp).Row
        y = ySh.Cells(Rows.Count, "H").End(xlUp).Row
            
        With ySh
            For Each sel In .Range("H2:H" & y)
                i = sel.Row
                r = xSh.Range("B4:B" & x).Find(sel, , xlValues, xlWhole).Row
                .Cells(i, 10) = xSh.Cells(r, 8)
                .Cells(i, 11) = xSh.Cells(r, 9)
                .Cells(i, 12) = xSh.Cells(r, 4)
                .Cells(i, 13) = xSh.Cells(r, 6)
                .Cells(i, 14) = (.Cells(i, 12) + .Cells(i, 13)) * .Cells(i, 9)
            Next
        End With
    End Sub
    

    atau dengan sedikit tambahan di skrip anda :

    Sub FindValue()
    Dim Lastrow As Long
    Dim SourceSheet As Worksheet
    Dim SourceLastrow As Long
    
        Set SourceSheet = Worksheets("HARGA")
        
        With SourceSheet
            SourceLastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
        End With
    
        With Worksheets("DATA")
            Lastrow = .Cells(Rows.Count, "H").End(xlUp).Row
            .Range("J2:J" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C8:R" & SourceLastrow & "C8,MATCH(RC[-2],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("K2:K" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C9:R" & SourceLastrow & "C9,MATCH(RC[-3],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("L2:L" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C4:R" & SourceLastrow & "C4,MATCH(RC[-4],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("M2:M" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C6:R" & SourceLastrow & "C6,MATCH(RC[-5],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("N2:N" & Lastrow).FormulaR1C1 = "=(RC[-2]+RC[-1])*RC[-5]"
            .Range("J2:N" & Lastrow).Value = .Range("J2:N" & Lastrow).Value
        End With
         
    End Sub
    

    kalau mau formulanya tetap ada (tidak value) tapi tersembunyi :

    Sub FindValue()
    Dim Lastrow As Long
    Dim SourceSheet As Worksheet
    Dim SourceLastrow As Long
    
        Set SourceSheet = Worksheets("HARGA")
        
        With SourceSheet
            SourceLastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
        End With
    
        With Worksheets("DATA")
            Lastrow = .Cells(Rows.Count, "H").End(xlUp).Row
            .Range("J2:J" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C8:R" & SourceLastrow & "C8,MATCH(RC[-2],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("K2:K" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C9:R" & SourceLastrow & "C9,MATCH(RC[-3],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("L2:L" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C4:R" & SourceLastrow & "C4,MATCH(RC[-4],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("M2:M" & Lastrow).FormulaR1C1 = "=Index(HARGA!R4C6:R" & SourceLastrow & "C6,MATCH(RC[-5],HARGA!R4C2:R" & SourceLastrow & "C2,0))"
            .Range("N2:N" & Lastrow).FormulaR1C1 = "=(RC[-2]+RC[-1])*RC[-5]"
            .Range("J2:N" & Lastrow).FormulaHidden = True
            .Protect
        End With
         
    End Sub

  5. @manweljs_
    Setelah saya coba ( copas :D ) scritp contoh yang mudah saya pahami , untuk script yang saya buat + ada tambahan dari @manweljs_ sudah mulai paham alurnya ( lebih mudah yang contoh ' heheehehe )
    Karena script yang saya buat hasil searching sana sini jadi , saya sendiri terkadang bingung ^_^;.

    mohon maaf sebelumnya , karena saya baru belajar mungkin akan ada pertanyaan saya yg agk aneh mungkin tidak nyambung

    Next :
    1. saya masih belum paham mengenai hasil macro , yang sebelumnya menggunaka scrip saya masih muncul rumusnya ,
    Apkaha itu ada pengaturan di excelnya ? karena saya mencari di module tidak ada scriptnya
    2. Apakah bisa Tuslah di buat menjadi b mode list ( tuslah 1 & tuslah 2 ) kemudian harga tuslah akan otomatis berganti mengikuti tuslah yang saya pilih

    Terima kasih

  6. Di sunting 4 tahun lalu oleh manweljs_

    @Chris212

    1. saya masih belum paham mengenai hasil macro , yang sebelumnya menggunaka scrip saya masih muncul rumusnya , Apkaha itu ada pengaturan di excelnya ? karena saya mencari di module tidak ada scriptnya

    kalau yang menggunakan skrip awal dari anda, bagian skrip yang saya tambahkan ini :

    ...
    .Range("J2:N" & Lastrow).Value = .Range("J2:N" & Lastrow).Value
    ...


    tugasnya seperi Copy Paste Values, jadi semua sel yang ada di range tersebut disalin value nya saja

    sementara yang hidden formula :

    ...
    .Range("J2:N" & Lastrow).FormulaHidden = True
    ...

    itu adalah pengaturan format selnya untuk meng-hide formula, tapi hanya berlaku jika sheet tersebut di protek. itu sebabnya ada baris perintah .Protect.
    kalau dilakukan manual caranya klik kanan pada sel yang diseleksi, pilih Format Cells, pilih tab Protection kemudian centang pilihan Hidden, seperti pada gambar ini :
    hide-formulas-excel.png
    sekali lagi, cara hidden formula ini hanya berlaku jika sheetnya di protek

    sedangkan untuk skrip yang saya buat, memang tidak pernah menggunakan formula, tapi mengambil nilai yang ada pada baris yang di cari kemudian ditampilkan dan dihitung

    2. Apakah bisa Tuslah di buat menjadi b mode list ( tuslah 1 & tuslah 2 ) kemudian harga tuslah akan otomatis berganti mengikuti tuslah yang saya pilih

    bisa aja, contohnya terlampir

  7. @manweljs_

    Sebelumnya terima kasih banyak , sudah membantu saya ^_^
    semua penjelasan mudah untuk dipahami
    sebenarnya data yang saya kirim bukan data asli saya , karena data perusahaan saya tidak berani share
    semua script yang sudah di berikan @manweljs_ , akan saya terapkan dan coba kembangkan ke data kantor saya

    untuk saat ini saya akan mempeajari script yg sudah ada ini , untuk problem - proble yang akan datang mohon bimbingannya
    Semoga ilmu @manweljs_ tidak pernah habis ..
    Terima kasih ^_^

  8. @Chris212 Terima kasih ^_^

    sama - sama :)

  9. @manweljs_

    maaf tanya lagi

    1. apakah ada script untuk penjumlahan berdasarkan 2 kriteria tertentu ( data saya berdasarkan, " tanggal + kendaraan )
    2. Apakah ada script untuk pembagian ( rasio % )
  10. Di sunting 4 tahun lalu oleh manweljs_

    @Chris212

    lama2 banyak juga :) - terlampir contohnya

  11. @manweljs_
    Hehehehe
    maaf master , saya membuat script beruntun
    soalnya saya pernah baca baca tapi tidak paham
    saya bisa paham jika ada contoh , saya pelajari terus saya otak atik efeknya bagaiamana

    saya lebih suak parktek dari pada membaca , heheheh
    Terima kasih , masih diberi scriptnya ^^

  12. @Chris212

    gak apa2 banyak yang penting anda paham :P

  13. @manweljs_

    For Each sel In .Range("B2:B" & y)
    i = sel.Row
    .Cells(i, 15) = totalharga(i, y)
    If Len(.Cells(i, 14)) And Len(.Cells(i, 15)) Then
    .Cells(i, 16) = .Cells(i, 15) / .Cells(i, 10)
    Else
    .Cells(i, 16) = ""

    End If
    Next

    mau tanya , script yg saya coret itu berfungsi untuk apa ya ?
    saya coba untuk diterapkan ke data utama saya , total Harga saya tidak terjumlah

  14. Di sunting 4 tahun lalu oleh manweljs_

    @Chris212 ...script yg saya coret itu berfungsi untuk apa ya...

    itu untuk mengecek apakah pada baris i di kolom 14 dan kolom 15 ada nilainya atau tidak, jika ada nilainya maka akan dilakukan perhitungan rasio untuk kolom 16, jika tidak ada maka akan dibuat null string.

    demikian

  15. @manweljs_
    Terima kasih master , saya mulai paham fungsi Iflen .. nya dan untuk kenapa T.hasil harga saya tidak bisa terjumlah karena ada salah penempatan script ( heehehehe )

  16. @manweljs_
    master mau tanya , agar script berjalan sesui urutan bagaimana ya ?
    saya jalankan muncul error " Runtime error 11 - division by zero "
    Sub .....()

    Dim a As Long, b As Long, r As Long, aSh As Worksheet, bSh As Worksheet
    Set aSh = Worksheets("HARGA_KONTRAK")
    Set bSh = Worksheets("KEMAJUAN")

    a = aSh.Cells(Rows.Count, "B").End(xlUp).Row
    b = bSh.Cells(Rows.Count, "I").End(xlUp).Row

    With bSh
    For Each sel In .Range("I2:I" & b)
    i = sel.Row
    r = aSh.Range("B3:B" & a).Find(sel, , xlValues, xlWhole).Row
    .Cells(i, 11) = aSh.Cells(r, 8)
    .Cells(i, 12) = aSh.Cells(r, 9)
    .Cells(i, 13) = aSh.Cells(r, 4)
    Next
    For Each sel In .Range("B2:B" & b)
    i = sel.Row
    .Cells(i, 17) = aSh.Cells(r, 13)
    'total target harga
    .Cells(i, 18) = .Cells(i, 17) * .Cells(i, 6)

    Next
    'dropdown tuslah
    If .Range("N1") = "TUSLAH Rp.0" Then
    .Cells(i, 14) = aSh.Cells(r, 5)
    ElseIf .Range("N1") = "TUSLAH Rp.10.000" Then
    .Cells(i, 14) = aSh.Cells(r, 6)
    Else
    .Cells(i, 14) = aSh.Cells(r, 7)
    End If
    'hasil harga
    .Cells(i, 15) = (.Cells(i, 13) + .Cells(i, 14)) * .Cells(i, 10)
    'total hasil harga
    .Cells(i, 16) = totalharga(i, b)
    If Len(.Cells(i, 15)) And Len(.Cells(i, 16)) Then
    .Cells(i, 19) = .Cells(i, 16) / .Cells(i, 18)
    End If
    'total harga + rasio
    For Each sel In .Range("B2:B" & b)
    i = sel.Row
    .Cells(i, 16) = totalharga(i, b)
    If Len(.Cells(i, 15)) And Len(.Cells(i, 16)) Then
    .Cells(i, 19) = .Cells(i, 16) / .Cells(i, 18)
    Else
    .Cells(i, 19) = ""
    End If
    Next
    End With
    End Sub

  17. Di sunting 4 tahun lalu oleh manweljs_

    @Chris212 ...saya jalankan muncul error " Runtime error 11 - division by zero ...

    Error tersebut kemungkinan besar terjadi pada baris :

    .Cells(i, 19) = .Cells(i, 16) / .Cells(i, 18)


    dugaan saya karena pada .Cells(i, 18) nilainya 0 (nol) atau string atau null string. di excel nilai berapapun jika anda bagi (/) dengan 0 atau string atau null string hasilnya pasti error

    tapi itu cuma dugaan saja, sebaiknya lampirkan filenya biar bisa dipelajari.

  18. Di sunting 4 tahun lalu oleh Chris212

    @manweljs_
    Sudah ketemu masalahnya kenapa terjadi errorr , ternyata setelah saya ceg ulang dan merapikan urutan scriptnya ternyata bisa ( heheeeheh )
    tapi setelah saya rapikan ada hasil yg tidak sesui di bagian " target rental "
    apakah ada salah di script atau memang harus ada penulisan scrip ditempat baru ?

    # Sudah ketemu , heheheeh ^^

  19. Di sunting 4 tahun lalu oleh manweljs_

    @Chris212 tapi setelah saya rapikan ada hasil yg tidak sesui di bagian " target rental "

    pada baris

    .Cells(i, 17) = .Cells(r, 13)


    edit menjadi

    .Cells(i, 17) = aSh.Cells(r, 13)


    .Cells(r, 13) merujuk pada sheet Kemajuan baris r kolom ke 13 karena .Cells(r, 13) masih masuk dalam lingkup With bSh (Sheet Kemajuan).
    sedangkan aSh.Cells(r, 13) merujuk pada Sheet Harga Kontrak baris r kolom ke 13

    demikian

  20. @manweljs_
    Siapp
    saat unit & kegiatan kosong muncul error , supaya tidak menjadi error dan ada pesan " Unit / Kegiatan - Harus di isi "
    apkah ada scriptnya ?

  21. Newer ›
 

atau Mendaftar untuk ikut berdiskusi!