• Ask an Expert
• Get a Professional Answer
• 100% Satisfaction Guarantee
Steven Caliendo, Computer Software Engineer
Category: Programming
Satisfied Customers: 116
Experience:  Over 15 years professional experience as a software development engineer. Awarded 8 US Patents
629026
Type Your Programming Question Here...
Steven Caliendo is online now

# What is the flowchart and then. example:If (oddNo =

### Customer Question

Hi, what is the flowchart for if and then. example:If (oddNo = oddNoReq) And (evenNo = evenNoReq) _
And (sumArr >= minSumValue) And (sumArr <= maxSumValue) _
And (LoopRow(XceptValues, sumArr)) Then
Submitted: 1 year ago.
Category: Programming
Expert:  LogicPro replied 1 year ago.

Hi

What is the deadline

Customer: replied 1 year ago.
no deadline, is a personal project, I am trying to add one more condition to the code.
Input E9 = minV . E10= maxV I have my generate list at L:Q. Perfect output . IF column Q minus column L >= E9 and <= E10 then show the combination
code:
Option ExplicitPublic sumArr As Long, oddNo As Long, evenNo As Long, oddNoReq As Long, LastRow As Long, _
evenNoReq As Long, minSumValue As Long, maxSumValue As Long, lRow As Long, testRow As Long, minMaxRn As Long
Sub Combinations()
Dim rRng As Range, p As Integer
Dim vElements, vresult As Variant
Dim q As Integer
Dim b As Double
Dim exceptrange As Range 'variable for exceptionsSet exceptrange = Range("D12:D22") 'INPUT SUM EXCEPTIONSSet rRng = Range("A1", Range("A1").End(xlDown)) 'INPUT NUMBERS TO PLAY
oddNoReq = Range("D7"): evenNoReq = Range("D6"): minSumValue = Range("D9"): maxSumValue = Range("D10")lRow = 1: testRow = 1p = 6: b = 1For q = 0 To p - 1
b = b * (LastRow - q) / (p - q)
Next q
Range("E33") = b 'OUTPUT TOTAL COMBINATIONSvElements = Application.Index(Application.Transpose(rRng), 1, 0)ReDim vresult(1 To p)
Columns("K").Resize(, p + 15).ClearCall CombinationsNP(vElements, p, vresult, lRow, 1, 1, exceptrange)
Exit SubEnd Sub
Sub CombinationsNP(vElements As Variant, p As Integer, vresult As Variant, lRow As Long, iElement As Integer, iIndex As Integer, XceptValues As Range)
Dim i As Integer, k As Integer
For i = iElement To UBound(vElements)
vresult(iIndex) = vElements(i)
If iIndex = p Then 'P IS THE 6 NUMBERS OR SIX COLUMNS
For k = LBound(vresult) To UBound(vresult) 'HERE IS PRODUCED THE COMBINATIONS
If vresult(k) Mod 2 0 Then oddNo = oddNo + 1
If vresult(k) Mod 2 = 0 Then evenNo = evenNo + 1
sumArr = sumArr + vresult(k)
Next k
If (oddNo = oddNoReq) And (evenNo = evenNoReq) _
And (sumArr >= minSumValue) And (sumArr <= maxSumValue) _
And (LoopRow(XceptValues, sumArr)) Then
lRow = lRow + 1
testRow = testRow + 1
Range("L" & lRow).Resize(, p) = vresult 'OUTPUT COMBINATION MATCH CRITERIA
Range("S" & lRow) = sumArr 'OUTPUT SUM BY ROW
Range("W" & lRow) = Range("Q" & lRow) - Range("L" & lRow)
Range("U" & lRow) = Range("O" & lRow) - Range("N" & lRow)
Range("V" & lRow) = Range("P" & lRow) - Range("M" & lRow)
End If
End If
If iIndex p Then
Call CombinationsNP(vElements, p, vresult, lRow, i + 1, iIndex + 1, XceptValues)
End If
sumArr = 0
evenNo = 0
oddNo = 0
Next i
End SubPublic Function lastRwCt() As Long
Dim o As Long
lastRwCt = Range("A1").CurrentRegion.Count
End Function
Sub sortDataFirst()Range("A1:A30").Select 'INPUT NUMBERS TO PLAY
End SubFunction LoopRow(inputCol As Range, n As Long) As Boolean 'THIS IS FOR THE SUM EXCEPTION LOOPDim c As RangeFor Each c In inputCol
If c.Value = n Then
LoopRow = False
Exit Function
End If
Next c
LoopRow = True
End Function
Expert:  LogicPro replied 1 year ago.

Can you provide me complete requirements

Customer: replied 1 year ago.
PROBLEM TO SOLVEVariable Legend
minV = minimum value
maxV= maximum value
Dif = differentialVariable Location
E9 = minV
E10= maxVOutput Location
Array elements 6
Index “0” column (“L2”)
Index “6” column (“Q2”)Processing
Column (“Q”) minus Column (“L”) = Dif
If Dif >= minV and Dif <= maxV then
Output is perfect.
Customer: replied 1 year ago.
correction
If Dif >= minV and Dif <= maxV then
Output is perfect.
Customer: replied 1 year ago.
dif>=max
then
perfect output
Expert:  LogicPro replied 1 year ago.

My apologies, I am out of ideas and opting out for other Professionals to answer. Please wait. You will be notified by email as soon as any Professional joins you.

I would be happy to help you with your other questions though.

Thank you for your patience.

Expert:  Raj replied 1 year ago.

Seems like you are writting a VB macro in excel. You need a generalized flowchart for some particular part or for the whole code?

Customer: replied 1 year ago.
N O, I need to add a condition.
Expert:  Chris Baxter replied 1 year ago.

If (oddNo = oddNoReq) And (evenNo = evenNoReq) _
And (sumArr >= minSumValue) And (sumArr <= maxSumValue) _
And (LoopRow(XceptValues, sumArr)) Then

Flow:

IF >> COMPARE >> AND >> COMPARE >> AND >> COMPARE >>AND >> COMPARE >> AND COMPARE (Are all equal, less than, or more than the compared value) >> THEN >> TODOCODE

This is a very over-loaded if-then statement already. Have you considered the error handling involved if any of these values are NOT inside the expected pass-through range?

Customer: replied 1 year ago.
I think there are a little misunderstanding about my question, I upload a code, and the condition to be added. so your post IS NOT WHAT i AM LOOKING FOR.
Expert:  Chris Baxter replied 1 year ago.

So you are not asking for a flow-chart, which is what you asked for explicitly. You are trying to get:

Input E9 = minV . E10= maxV

set as a condition in your code? I will opt out here and allow someone with a bit more time to play with it see if they can get that to work.

Expert:  Steven Caliendo replied 1 year ago.

Hi Jeyner,

I just read the top line of your request, and have attached what I believe it is that you want (from this) "want to see the flowchart of this syntax, and then maybe I will be able to finish my project"

I've attached flow charts and a UML activity chart of your code. Hopefully this will help you out.

Best Regards,

Steve