简体   繁体   中英

updating a cell with a concatenated reference from another sheet

I'm having trouble starting this VBA code.

I have two spreadsheets Sheet 1 and Sheet 2 that have data for clients. The one column in sheet 2 has a value set to a number + Sales Office location(ie 750-UNKNOWN, 841-UNKNOWN, 160-NC - GREENVILLE). I want to search that column for the "Unknown" value and use the number from that value ie 750 to match it from another worksheet (Sheet 1) by looking up the appropriate value and updating the cell in sheet 2 to that number and the name in the next cell by concatenating it in the cell.

Sheet 2

  • Reference

-771-UNKNOWN (cell H2)

  • 720-UNKNOWN (Cell h3)

    • Sheet 1 AB
      New FSO New FSO Name
      105 (A2) Kentucky (B2)
      60 (A3) Taft-Hartley (B3)

I don't know where to begin with doing this.

Additionally, I need to set a rule that if the value isn't found during the search ie if 750 isn't in the list, then return "No Sales Office located"

Thank you!

如果(中(h2,len(h2)-7),7)=“未知”,左(h2,len(h2)-7),“没有销售办公室”)如果未知是犹他州(那么它将改变7)将是4)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM