Retrieve data from an Excel table into another table.

julietterichelieu

New Member
Joined
Feb 14, 2022
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I would like to retrieve data from an Excel table into another table.

In my table I have to retrieve in column AX, the data according to two criteria in column E and in column F

If in column E there is "VMO" and in column F there is "EKZEK" then take the value in column "AX" on the same line and give me the value "215" in cells N14 for example

1644850005004.png


Is it possible??

Thanks in advance
 

Attachments

  • 1644849929050.png
    1644849929050.png
    24.3 KB · Views: 12
Try:
VBA Code:
Sub retrieveData()
    Application.ScreenUpdating = False
    Dim v As Variant, i As Long, x As Long, srcWS As Worksheet, desWS As Worksheet, desRng As Range
    Set srcWS = Sheets("Data")
    Set desWS = Sheets("Inventaire")
    Set desRng = desWS.Range("B2", desWS.Range("B" & Rows.Count).End(xlUp))
    v = srcWS.Range("E2", srcWS.Range("E" & Rows.Count).End(xlUp)).Resize(, 9).Value
    For i = 1 To UBound(v)
        If v(i, 1) = "VMOB" Then
            If Not IsError(Application.Match(v(i, 2), desRng, 0)) Then
                x = Application.Match(v(i, 2), desRng, 0)
                With desWS
                    .Range("D" & x + 1).Resize(, 2).Value = Array(v(i, 8), v(i, 9))
                End With
            End If
        End If
    Next i
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top