+ Reply to Thread
Results 1 to 4 of 4

Nested if and or else or vb which is best?

  1. #1
    Registered User
    Join Date
    01-07-2015
    Location
    Nottingham
    MS-Off Ver
    2010
    Posts
    74

    Nested if and or else or vb which is best?

    Hello Guys

    Really hoping for some help and support on this one as I have gotmy proverbial pants in atwist and I can no longer see the light at the end of the tunnel.

    I am building (what should be) a simple calendar/reference tool, but for some reason I have got so far and got seriously brain blocked and confused.

    Scenario and what I am aiming for
    Data input for a date, a place, and appointment type and run against existing data to identify if the given rules are met to return a yes go ahead and book or not you cant have that date/type/area
    Therules being I can only have 2 first jobs on any given day in any given area (total of 23 area's)
    I can have a total of 6 appointments in any area on any day, so
    2x first jobs and 4 of any other
    1x first job or 5 of any other
    0x first jobs and 6 of any other

    I figure that nested IF formula or VB is the best way to go at it but I have looked at it for so long I have gotten that coding fog which seems to happen when you are teaching yourself.

    I would love some 'shoving in the right direction' as I would rather make errors and learn than be given the answer.
    I have attached what I have so far with my random thoughts and what I think shouldgo where.

    I think I need to understand how I reference the input data on the tab of the same name row 6, 7 and 8 to associated columns on DATA tab (test data is actually on specific tab currently but thats for later

    My current macros are working lovely and i feel I should just be able to add to what I have.
    What I want may not even be possible, but a woman can hope for miracles.

    Coding etc all on attached workbook.
    Question me at length if any of this is not clear.

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Nested if and or else or vb which is best?

    Hey Sarah,

    If looks like you are in an office and doing scheduling for workers. On your Specific Tab you have a column called "Job Type" that is sometimes "Job 1" and other times it is a date. This is bad. You need 2 columns here. One column for Date of Service and another for Job Number.

    The first problem is to make your tables consistant. Add more data and explain why/when a message should show as "Already booked". Give us a bigger overview of this problem.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Nested if and or else or vb which is best?

    1) Perhaps simulate some results so we can see what you want and where you want it.
    2) Do your limits include the appointment being booked? For example, can you book a THIRD first job, or is 2 the OVERALL limit?
    Last edited by leelnich; 09-05-2017 at 09:15 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  4. #4
    Registered User
    Join Date
    01-07-2015
    Location
    Nottingham
    MS-Off Ver
    2010
    Posts
    74

    Re: Nested if and or else or vb which is best?

    Hi Marvin, Hi Lee

    Thanks for pointing out the messy data *mortified*, I also bake so like to have everything in one place and ready before I start, I do know this needs tidying, it is test data only and I am rebuilding the entire thing and not ready as such for the data as yet.

    To answer both of your questions in one go.

    Colleague Will use this tool for 2 purposes -

    1) To validate/query if the appointment date/type and area is available that they want
    2) To record a specific appointment date/type and area so it can be included in the data for the next query

    I would like them to be able to enter this detail in the simple check boxes on the input page which is a job type, a date and an area,

    What is the Date? 08/09/2017
    Which Area? Derbyshire
    Job Type? 1st Job

    then press the 'check availability' button,

    which will run a script using this information, against the held data on the data tab to see if the rules as mentioned above are met, this will then return one of two outcomes

    a) a pop up box states 'This is available, please continue'
    b) a pop up box states 'This is not available, please choose a different date'

    To be dead honest if I could simulate this I would possibly not need help, I am confident enough, I think, that I can work this out and write it myself I am just stuck on the getting started.
    Everything I have developed so far with other tools I have been able to record a macro for elements and build out from that point. I cannot do that with this, and not sure why but thats an entirely new question, but do know I probably need a nested if function to validate my dates, area's and first job types, I am also reading around and learning INDEX and MATCH as possible routes with which to code this.

    What I am not sure about, is how I express in VB the conditions for the 'wanted values', which will allow me to reference that in the nested if functions. I can reference the columns of data to check against and manage a few less than and greater than values. The need help bit is the input data and how I reference that?

    It may also be that I have been blind sided and I can record a macro to help me, but I can get my hear around that either.
    I have been trying to run this using some of the functions referenced above as straight forward formula, but with litte joy or inspiration.

    I again must state I do not want a solution but some suggestions for best forward that I can explore for myself, hints and tips not solutions as I am teaching myself and learn well by experimenting

    Thanks guys, aware I may have waffled LOL Apologies.
    Last edited by Missus Mommabear; 09-13-2017 at 09:58 AM. Reason: add details requests by forum members

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Nested vlookup or nested IFAND function?
    By jeptik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-11-2017, 02:27 AM
  2. Nested IF statement error. Nested True statement is not triggering
    By Lucas7040 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2016, 11:41 AM
  3. Easier Way To Decipher Nested Nested IF's
    By Vladamir in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2015, 03:37 PM
  4. [SOLVED] Nested Sumif's or how to sum data based on nested criteria
    By dlietz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-07-2014, 11:36 AM
  5. How to reduces Nested IF code(144 Nested IF) to achive same functionality
    By jobseeker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2014, 09:45 AM
  6. Replies: 0
    Last Post: 10-01-2012, 05:54 AM
  7. help on a nested countif/nested if formula
    By vickiemc in forum Excel General
    Replies: 2
    Last Post: 08-13-2008, 08:29 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1