• 0

Excel formula/macro help.


Question

I hope this is where I should put this.

I was asked to help with a project at work involving moving some data from one excel spreadsheet to another, and I could use a little help figuring out how the formula would work or if a macro would be involved. I'll try my best to explain the situation.

There are two different spreadsheets, the first one contains a list of employees, the agents they are assigned to, the agents number, a column listing how many hours of work type A they are required to do and another column listing for work type B. The second spreadsheet also has a list of these employees as well as a column showing an employee assigned to them to help with work type B and the agent with his/her number and how much of work type B.

What I need is a formula/macro that will automatically take the relevant information from the first worksheet and post it on the second. The problem is that some of the agents only have work type A and some only B. The second spreadsheet needs to only have either all work B or a mix of work A and B. It can not have any of the agents that have only work type A.

I know this may sound confusing, but I have tried everything from =if formulas to =hlook statments, and tried a mix of both. Maybe there just isn't a way to do this and I"m fighting a lost cause. Anyone here with mad excel skills that can help out?

Rough mock up.

Worksheet 1

| employee | agent | agent # | work A # | work B # | agent2 | agent2 # | work A # | work B # | agent3 | agent3 # | work A # | work B # | etc....

| employee2 | agent | agent # | work A # | work B # | agent2 | agent2 # | work A # | work B # | agent3 | agent3 # | work A # | work B # | etc....

| employee3 | agent | agent # | work A # | work B # | agent2 | agent2 # | work A # | work B # | agent3 | agent3 # | work A # | work B # | etc....

Worksheet 2

| employee | helper | agent | agent # | work B # | agent2 | agent 2# | work B # | agent3 | agent 3# | work B # | etc...

| employee2 | helper2 | agent | agent # | work B # | agent2 | agent 2# | work B # | agent3 | agent 3# | work B # | etc...

| employee3 | helper3 | agent | agent # | work B # | agent2 | agent 2# | work B # | agent3 | agent 3# | work B # | etc...

Link to comment
https://www.neowin.net/forum/topic/1074101-excel-formulamacro-help/
Share on other sites

6 answers to this question

Recommended Posts

  • 0

The info that is in sheet two needs to match the same thing in sheet 1, thing is the information is not static. every couple of months the agent changes and so does the work A and B amounts. So right now agent 1 may have no A and only B but next month it might be the opposite. The second sheet needs to reflect the data from the first ONLY if the agent has some type of work B wheter that be both A and B or just B.

  • 0

Ah, let me get this straight:

  • The only static columns in worksheet 2 are employee and helper, the rest of the columns are populated from worksheet 1, yes?
  • Is there a set amount of agents in worksheet 1, or is it just a list of relevant agents for that employee and their assigned work?
  • I assume you can check for work B by checking that if the number in the work B # cell is zero or not?

  • 0

Ok, so we figured it out, it works out like this.

In the agent code field in the second sheet we used this code:

=IF(VLOOKUP(A8,Sheet1!$A$1:Sheet1!$E:$E,5,FALSE)=0,"NO RETENTION",VLOOKUP(A8,Sheet1!$A$1:Sheet1!$E:$E,3,FALSE))

In the Work B field we used this code:

=IF(C8="NO RETENTION",0,VLOOKUP(A8,Sheet1!$A$1:Sheet1!$E:$E,5,FALSE))

..glad to be done with all that mess.

This topic is now closed to further replies.
  • Posts

    • Win11Debloat 06.11.2026 by Razvan Serea Win11Debloat is a lightweight, easy to use PowerShell script that allows you to quickly declutter and customize your Windows experience. It can remove pre-installed bloatware apps, disable telemetry, remove intrusive interface elements and much more. The script also includes many features that system administrators and power users will enjoy. Such as a powerful command-line interface, support for Windows Audit mode and the option to make changes to other Windows users. All changes made by Win11Debloat can be easily reversed, and most removed apps can be restored via the Microsoft Store. A full guide on how to undo the changes is available here. Win11Debloat features: Below is an overview of the key features and functionality offered by Win11Debloat. Please refer to the wiki for more information about the default settings preset. Remove a wide variety of preinstalled apps. Click here for more info. Disable telemetry, diagnostic data, activity history, app-launch tracking & targeted ads. Disable tips, tricks, suggestions & ads across Windows. Disable Windows location services & app location access. Disable Find My Device location tracking. Disable 'Windows Spotlight' and tips & tricks on the lock screen. Disable 'Windows Spotlight' desktop background option. Disable ads, suggestions and the MSN news feed in Microsoft Edge. Hide Microsoft 365 ads on the Settings 'Home' page, or hide the 'Home' page entirely. Disable & remove Microsoft Copilot. Disable Windows Recall. Disable Click to Do, AI text & image analysis tool. Prevent AI service (WSAIFabricSvc) from starting automatically. Disable AI Features in Edge. Disable AI Features in Paint. Disable AI Features in Notepad. Disable the Drag Tray for sharing & moving files. Restore the old Windows 10 style context menu. Turn off Enhance Pointer Precision, also known as mouse acceleration. Disable the Sticky Keys keyboard shortcut. Disable Storage Sense automatic disk cleanup. Disable fast start-up to ensure a full shutdown. ...and more. Once you’ve downloaded the Win11Debloat file (Get.ps1), just follow these quick steps: Locate the Get.ps1 script file. Right-click the file and select Run with PowerShell from the context menu. If prompted by User Account Control (UAC), select Yes to grant the script the necessary administrative permissions. Win11Debloat 06.11.2026 fixes: Fix lock screen spotlight option being disabled when disabling the start recommended section by @Raphire in #619 Fix log message formatting by @Raphire Note The -RemoveCommApps and -RemoveW11Outlook command-line parameters for uninstalling a few specific apps have been removed with this release. If you previously relied on these parameters, please see this wiki page for alternative methods of removing these apps. Download: Win11Debloat 06.11.2026 | Open Source View: Win11Debloat Home Page | Screenshots 1| 2 Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Yes for me, I installed 'old calculator' (Windows 7 calculator) in its place since it is more useful to me. I think paint is the only one I left installed
    • eh I'll wait for the June 2026 MVS ISO downloads which should be coming out next Tuesday June 16 and possibly contain build 8655 instead of 8653
  • Recent Achievements

    • Rookie
      restore went up a rank
      Rookie
    • Very Popular
      AndrewSteel earned a badge
      Very Popular
    • Veteran
      Taliseian went up a rank
      Veteran
    • One Month Later
      Clizby earned a badge
      One Month Later
    • One Month Later
      Timaximus earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      512
    2. 2
      +Edouard
      162
    3. 3
      PsYcHoKiLLa
      155
    4. 4
      ATLien_0
      82
    5. 5
      Steven P.
      79
  • Tell a friend

    Love Neowin? Tell a friend!