Consulting

Results 1 to 12 of 12

Thread: Dependant cells

  1. #1
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location

    Dependant cells

    Two young enterprising lads (Zack & Jake) bought the local parts and service centre at Walkabout Creek and promptly named the business Walkabout Creek Fixerup Services. However they were having a bit of a problem with what parts were in the shop, so decided to hold a 5 day, in-house team building camp out at the local watering hole. About 3 and a bit days into the bender ( sorry I mean team moral building exercise where they were discussing the need for a spreadsheet), when Zack's missus sent a message to the Publican saying that could he send the useless sod home to fix the damage caused when Rutter the feral boar and Zack's bull Mastiff cross "Fluffy" had a bit of a disagreement about who had rights to the scrap bin. Apparently most of the carrots, beans and only remaining cabbage were scattered about the yard. Zack, you remember the cabbages you were meant to spray for moths last week, but you told the wife that you had run out of the good stuff but there was a small drum of Agent Orange in the back of the shed, that you thought would give the moths a run for their money. The Missus knew something was up when you took off with the big esky and two fishing rods.....

    Anyway the accountant Paul, sent our boys a spread sheet with Part Numbers and a Part description list and the boys were instructed to fill in the Alley Colour and Bin Numbers for the parts. On sheet 2 of the workbook is the current parts in stock. Some of the more astute of you will notice that the location of parts is... well haphazard to say the best, but as all young enterprising lads are often heard to say " we're a little busy right now but we plan on resorting the shed at the next available opportunity. Perhaps in the wet season. They've heard that George a local cocky is soon going to be putting in an order for spare parts and the boys need to both find the parts and be able to correctly invoice George.

    On sheet 1 of the Accountant's workbook is a small 4 cell range with dropdowns relevant to the header for each dropdown, The experienced accountant Paul wants the ability to simply enter in the Part Number and the other three cells are automatically filled in with the correct data, where as Jake would rather simply enter in the Part Description and have the other cell completed, and Zack ... well he's got a rough idea where the part could be and is willing to go along with Jake's Idea.

    Can anyone write some code to enable either method to be used please?
    Attached Files Attached Files
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  2. #2
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,190
    Location
    Nice story, you could have a cell for 'Part #' and a cell for 'Description' and then next to that the 4 cells you had and use XLOOKUP if using Excel 365.

    Are you using Excel 365 for this?
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2403, Build 17425.20146

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    Yes 365. I have four cells already in place each with a dropdown if that helps you, and George, go easy with the formula stuff. You have a history of writing long long formulas once you get started,
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Quote Originally Posted by Aussiebear View Post
    Two young enterprising lads (Zack & Jake) bought the local parts and service centre at Walkabout Creek and promptly named the business Walkabout Creek Fixerup Services. However they were having a bit of a problem with what parts were in the shop, so decided to hold a 5 day, in-house team building camp out at the local watering hole. About 3 and a bit days into the bender ( sorry I mean team moral building exercise where they were discussing the need for a spreadsheet), when Zack's missus sent a message to the Publican saying that could he send the useless sod home to fix the damage caused when Rutter the feral boar and Zack's bull Mastiff cross "Fluffy" had a bit of a disagreement about who had rights to the scrap bin. Apparently most of the carrots, beans and only remaining cabbage were scattered about the yard. Zack you remember the cabbages you were meant to spray for moths last week, but you told the wife that you had run out of the good stuff but there was a small drum of Agent Orange in the back of the shed that you thought would give the moths a run for their money. The Missus knew something was up when you took off with the big esky and two fishing rods.....

    Anyway the accountant Paul, sent our boys a spread sheet with Part Numbers and a Part description list and the boys were instructed to fill in the Alley Colour and Bin Numbers for the parts. On sheet 2 of the workbook is the current parts in stock. Some of the more astute of you will notice that the location of parts is... well haphazard to say the best, but as all young enterprising lads are often heard to say " we're a little busy right now but we plan on resorting the shed at the next available opportunity. Perhaps in the wet season. They've heard that George a local cocky is soon going to be putting in an order for spare parts and the boys need to both find the parts and be able to correctly invoice George.
    This sounds like a homework assignment
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,190
    Location
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2403, Build 17425.20146

  6. #6
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    Edumacation is top stuff round 'ere in Walkabout Creek.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  7. #7
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    I have followed your advice George and changed the cells to run vertically with only Part # (D4) and Part Description (D5) now listed as DV cells. In cell D6 Ihave the formula =Xlookup(D4,PartNum,AlleyColor,0) to return the Colour of the Alley in which to look for the bin. In Cell D7 I have a similar formula =Xloookup(D4,PartNum,BinNum,0) which returns the correct Bin Number for the Part required.

    However I am more interested in the concept of using either cell D4 or D5 to drive the selection process.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  8. #8
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,190
    Location
    This is what I had in mind, just added a little code to clear one cell if the other cells dropdown is used.
    Attached Files Attached Files
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2403, Build 17425.20146

  9. #9
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,190
    Location
    Here's another option where you don't have to change the layout that you had.
    Attached Files Attached Files
    Last edited by georgiboy; 05-22-2023 at 02:03 AM.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2403, Build 17425.20146

  10. #10
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    George, can you explain the line

    If Target.Address(False,False) = "C8" Then
    Also in the alternative workbook you use

     Var=EVALUATE("XLOOKUP(" & Target.Address &",'DataSheet!A:A,'DataSheet!A:D,"""",0")
    There are seven Double Apostrophies, is one a left over or am I missing something here.
    Last edited by Aussiebear; 05-22-2023 at 05:59 AM. Reason: Combined two posts into one
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  11. #11
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,190
    Location
    I think i updated the spreadsheet a little while after i uploaded it so the first line you mention was replaced BUT'
    Writing this:
    If Target.Address(False, False) = "B8" Then
    Is the same as writing:
    If Target.Address = "$B$8" Then
    The (False, False) part removes tha absolute range so "$B$8" would become "B8"

    On this line:
    var = Evaluate("XLOOKUP(" & Target.Address & ",'Data Sheet'!A:A,'Data Sheet'!A:D,"""",0)")
    I count 8 "
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2403, Build 17425.20146

  12. #12
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    its seems I can't count.... Sorry George.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •