+ Reply to Thread
Results 1 to 14 of 14

VBA - Assign Value Of Cells Base On The Total Value Column And Row

  1. #1
    Registered User
    Join Date
    04-15-2015
    Location
    VietNam
    MS-Off Ver
    2013
    Posts
    7

    VBA - Assign Value Of Cells Base On The Total Value Column And Row

    i have a problem below:
    4-16-2015 12-34-02 PM.png
    as you can see the picture above:
    +The data with yellow highlighted is the available data.
    +The cells with a question mark is my expected data.
    The problem is my expected data have to satisfy the condition column and condition row (yellow highlighted). In particular, in Column 2, the total value of cells(2,2) and cells(3,2) have to be equal the value of cells(1,2). Moreover, the total value of cells(2,2), cells(2,3) and cells(2,4) have to be equal the value of cells(2,1) as well.
    Last edited by longnguyen93; 04-17-2015 at 05:35 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    I am unable to understand your requirement

    Please make it more descriptive for my better understanding


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    04-15-2015
    Location
    VietNam
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    here is the result from an simple example.
    4-16-2015 11-24-42 AM.png
    Attached Images Attached Images

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    Not sure which is your available data and which one is your expected result

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Registered User
    Join Date
    04-15-2015
    Location
    VietNam
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    The reply above is my expected result. I attach the exercise file (have not been solved yet) for you to understand.
    Phan bo nguoi cho tung Phieu chi - Copy.xlsx

    The yellow highlighted is the available data.
    Last edited by longnguyen93; 04-16-2015 at 12:59 AM.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    Still you are missing a logic.

    The data and the expected result are well known to you so it is easy for you to understand how to arrive the result.

    But for us it is a new set of data and we don't have time to sit and investigate what is mentioned there and how.

    Please explain your logic with a simple set of data instead of projecting a large file.

  7. #7
    Registered User
    Join Date
    04-15-2015
    Location
    VietNam
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    4-16-2015 12-34-02 PM.png
    as you can see the picture above:
    +The data with yellow highlighted is the available data.
    +The cells with a question mark is my expected data.
    The problem is my expected data have to satisfy the condition column and condition row (yellow highlighted). In particular, in Column 2, the total value of cells(2,2) and cells(3,2) have to be equal the value of cells(1,2). Moreover, the total value of cells(2,2), cells(2,3) and cells(2,4) have to be equal the value of cells(2,1) as well.
    Thanks for your patient.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    Quote Originally Posted by longnguyen93 View Post
    The yellow highlighted is the available data.
    I can only see one such cell in the workbook (?)

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  9. #9
    Registered User
    Join Date
    04-15-2015
    Location
    VietNam
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    game1.xlsx
    Please update the file. You just consider the yellow highlighted data. The other are just for testing the result. Thanks.

  10. #10
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    You need to include the logic in the samples, when I look at it I just see highlighted rows with illogical formulas.

  11. #11
    Registered User
    Join Date
    04-15-2015
    Location
    VietNam
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    Hi,
    I have just updated my post to clarify the question. According to the problem, I think I should use the backtracking algorithm to solve.

  12. #12
    Registered User
    Join Date
    04-17-2015
    Location
    hcm
    MS-Off Ver
    2014
    Posts
    1

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    I think this problem is the same with game Sudoku, but it have different number, and this data on cell and row of Excel file may have same number

  13. #13
    Registered User
    Join Date
    04-15-2015
    Location
    VietNam
    MS-Off Ver
    2013
    Posts
    7

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    Awesome!!!
    And the range of value is not fixed as Sudoku (1-9). It changes in every rows and columns.

  14. #14
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: VBA - Assign Value Of Cells Base On The Total Value Column And Row

    Here's what I see. This problem looks to me like a basic "solve a system of linear equations" like you learned about in your secondary algebra classes: http://www.purplemath.com/modules/systlin1.htm Back then, the problems were 2 or 3 equations with 2 or 3 unkowns. In the example given in post 9, you have ~800 equations in ~25000 unkowns.

    You should recall from your previous education that a problem with more unkowns than equations will likely not have a single, unique solution, but will have an infinite number of possible solutions. You may have to assume values for 24000 of those unkowns and then determine what that means for the remaining unkowns.

    Looking at the problem that way, Excel has two tools that are usually used for these kinds of problems. Excel has built in matrix functions (MINVERSE() and MMULT() for example) that can be used to solve systems of equations. There is also the Solver add-in for numerical algorithms to solve such problems.

    The main problem will be, that your problem is much larger than these tools will likely handle. I do not know the exact limit on the size of matrix that the MINVERSE() function will handle, but I suspect it is much smaller than this problem will need.

    Solver as it comes with Excel is limited to 100-200 unkowns. If you are willing to pay for the premium Solver package, you will be able to use upwards of 2000 unkowns (aka decision variables). It is still smaller than the problem you describe.

    My first suggestion would be to scale the problem back to something much smaller (maybe 10 x 3) to develop the algorithms. Once you have the algorithms worked out, then you can see how readily they will scale up to the problem at hand.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ 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] Macro to Total a Column Up 15 cells and place total in cell of last row
    By guitarsweety in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-20-2014, 05:25 PM
  2. [SOLVED] VBA to make Total base on condtion
    By yukioh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-30-2013, 10:07 PM
  3. how to transform data from row-base to column-base
    By fei2010 in forum Excel General
    Replies: 3
    Last Post: 11-23-2012, 12:17 AM
  4. Code: Assign Function(s) to all cells in a column
    By cbrd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-01-2006, 11:28 PM
  5. Replies: 1
    Last Post: 12-19-2005, 05:59 PM

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