Help in Excel column data matching and writing column values

Hi All,
I’m trying to lookup company names from Sheet1 to Sheet2. If sheet1 company matches in Sheet2 i need to pick those records and write in Output sheet.
Along with that i need to add few column values LOCATION and TITLE .

When i try to use add data column activity it is giving me errors like Add Data Column: Column ‘Location’ does not belong to table DataTable

I’m attaching my flow for reference .

Note : My code is working fine in filtering just needs to add additional SHEET1 columns to that .
CompanyNameMatch.zip (12.7 KB)

Hi,

Because you set row("Location").ToString at DefaultValue property but Sheet1_dt doesn’t have Location column. (row is from ForEachRow of Sheet1_dt)
Can you modify it to what you expect?

Regards,

Hi @Yoichi in sheet 1 I have location column. I want to add that column value in output sheet. Can you please check the output sheet once.

@Yoichi i have columns in sheet 1 when i try to get those it’s showing me error like can’t find that column. I don’t know how it’s happening.

Because of this code it’s keeping only Company column and removing rest.

Sheet1_DT Defaultview.ToTable(True,{Company"})

Hi,

How about the following?

Sheet1_DT.DefaultView.ToTable(True,{"Company","Location"})

Regards,

@Yoichi I have modified differently it is working fine. I will check this and will mark the solution.

If you’re looking to match and write values between columns in Excel, you can use various functions and methods. Here’s a simple guide:

Scenario: Matching and Writing Values

Let’s say you have data in columns A and B, and you want to match values in column A with those in column B. If a match is found, you want to write a corresponding value from column C to column D.

Steps:

  1. Assuming Data:
  • Column A: Original data
  • Column B: Data to match
  • Column C: Corresponding values to be written
  • Column D: Results (where you want to write values)
  1. Using VLOOKUP:
  • In cell D1, you can use a formula like =VLOOKUP(B1, A:C, 3, FALSE).
  • This formula looks for the value in B1 within the range A:C. If found, it returns the corresponding value from the third column (C). Adjust the formula based on your actual columns.
  1. Drag Down the Formula:
  • Drag the corner of cell D1 down to apply the formula to other cells in column D.
  1. Handling N/A (Not Found):
  • If a match is not found, the formula might return N/A. You can handle this using the IFERROR function:
    =IFERROR(VLOOKUP(B1, A:C, 3, FALSE), “Not Found”)
    This will write “Not Found” in column D if no match is found.
    | A | B | C | D |
    |--------|--------|--------|--------|
    | Apple | Banana | Red | Red |
    | Orange | Cherry | Orange | Orange |
    | Grape | Apple | Purple | Not Found |
    In this example, we are matching values in column B with those in column A. If a match is found, the corresponding value from column C is written to column D. If no match is found, “Not Found” is written.

Adjust the formula and columns based on your specific data and requirements.