How to Index Multiple Values into a Single Cell

kyzyfzh

New Member
Joined
Oct 11, 2022
Messages
2
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi Guys,

I am trying to get stock qty from Sheet(SOH), then update them to Sheet(Report) soh column. However, I am having a issue to index Multiple Values into a Single Cell. Any help would be greatly appreciated!


VBA Code:
Sub Fillstock_Neworder_Test()

    'Get qty, from SOH to Report'
    
    Dim i, lr, sold As Long
    Dim soh As Variant
    Dim sku, soh_str As String

    lr = Sheets("Report").Cells(Rows.Count, 1).End(xlUp).Row
    For i = 2 To lr
        sku = Sheets("Report").Cells(i, "B").Value
        soh = Application.IfError(Application.Index(Sheets("SOH").Range("A:Z"), _
            Application.Match(sku, Sheets("SOH").Range("A:A"), 0), 2), 0)
        soh_str = ": " & soh  'Get SOH String
  
    
        Sheets("Report").Cells(i, "C").Value = soh_str

    Next i
   
    End Sub
 

Attachments

  • Report.jpg
    Report.jpg
    36.3 KB · Views: 7
  • SOH.jpg
    SOH.jpg
    38.4 KB · Views: 6

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
TestAAA.xlsm
ABC
1Order IDskusoh
2R-17-09209-06644 CAB-ALO-C603PR CAB-ALO-C602GN CAB-ALO-C602WH CAB-ALO-C603RD CAB-ALO-C61.5PR: 0 : 0 : 0 : 0 : 0 : 1
3R-18-09208-69480PHC-OB-77-85801: 8
4R-22-09207-14580PHC-OB-77-85527: 1
Report


TestAAA.xlsm
AB
1skuqty
2CAB-ALO-C603PR0
3CAB-ALO-C602GN 7
4CAB-ALO-C602WH 0
5CAB-ALO-C603RD5
6CAB-ALO-C61.5PR1
7SC-ORI-SC2-BK0
8PHC-OB-77-855271
9MB-SIM-EC4151
10SP-OB-77-888501
11PHC-OB-77-858018
12PHC-OB-77-625421
13SP-PG-P27869
14CAB-8W-C5-ES1001
15CAB-8W-C5-ES1003
16PBK-CYT-CY3483P0
17PHC-OB-77-835511
18SDC-SD-32GFXSB1
19CAB-ALO-1M13B2
SOH
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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