Decision tree / Process flow chart program

cegbuna

New Member
Joined
Mar 26, 2011
Messages
37
I have a process flow chart with multiple trees I and I was wondering if there is a way to create a program in excel where I can click different buttons and be directed to different processes based on a YES or NO answer to questions in the flowchart boxes. I have provided an example below.

I know this is kind of confusing but I'll explain further if needed.

Thanks in advance.

220px-LampFlowchart.svg.png
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Flowcharts are a traditional method for designing programs: the diamonds represent places where conditions are tested and the rectangles represent places where actions are taken.

Flowcharts can be converted to 'pseudocode' which can then be converted into statements in whatever language you're using. So in the case of your flowchart above, you would turn it into the following pseudocode:-
Code:
Lamp_doesn't_work:
  If Lamp_plugged_in = False Then
    Call Plug_in_lamp
  Else
    If Bulb_burned_out = True Then
      Call Replace_bulb
    Else
      Call Buy_new_lamp
    End If
  End If
End Lamp_doesn't_work
You would then convert the pseudocode into language-specific statements.

Is that what you're asking?
 
Upvote 0
Thanks for the response.

I would like users to be able to click a button (starting point), and based on the users response, other actions are taken based on the structure of the tree. The flowchart I have is more complex than the example shown earlier (I can attach the actual flowchart if you want). Is there a way to do this?

Thanks again for the help.
 
Upvote 0
That's right: the structure of your flowchart dictates the structure of your code. The points at which you prompt the users - the decision points in the flowchart - are the points in the code where you evaluate conditions and make a decision as to where you want to go next.

This is what a programmer does: he turns a flowchart into code.

Are you saying that you want to feed a flowchart into some sort of 'black box' which churns out program code automatically?
 
Upvote 0
Exactly what am trying to do, but am new to programming and not sure how to go about it.

Thanks.
 
Upvote 0
IMHO no, its not possible. How would you know by clicking a shape whether the user is thinking "I want to say yes here ..." or the opposite. They'd have to click the arrow (not fun). And if the shape represents a decision ("is this a valid credit card number") there's not going to be any actual data to apply the criteria against so what do you do then? Personally I don't see much advantage - all that coding won't make a flow chart much easier to use as you can do the same thing with the flow chart as it is (just follow the flow chart).

As far as actually churning out a real program from a diagram it can be done but you must invest in serious software for doing this kind of thing (based on UML modeling or something like that) - and this can be tricky although we do have code now being written by programs. Some databases can be built this way (i.e., with Visio Enterprise edition or MySQL Workbench).
 
Upvote 0
Xenou, I think you and I are on different tracks here. I was working on the understanding that the OP merely wanted to know how he would go about turning a flowchart into code - you know, like programmers do, knowing how to write the code to test a condition or prompt the user for a respoanse, write an IF statement and perform the resulting actions, etc.

You're envisaging a scenario where he creates a flowchart on-screen, then presses a button and the program code is generated automagically somehow. I agree, that's considerably more difficult.
 
Upvote 0
Yes, that was my first reaction - an interactive flow chart. So the question is "if I have a flow chart of a program how do I create the program..." ?

In that case it's easy. Hire Ruddles. :biggrin:
 
Upvote 0
Coding is charged on a per-word basis. I reserve the right to use SELECT rather than IF.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top