+ Reply to Thread
Results 1 to 14 of 14

if cell x> 0 then copy range of cells

Hybrid View

  1. #1
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    if cell x> 0 then copy range of cells

    hi all
    new to the forum and looking for some help on a spreadsheet

    i have a sheet with a list of products,prices quantity etc

    what i want to do is if a cell has a greater value than o then copy a range of cells to another sheet in the next available row

    could this be done with =IF or would it need a macro to do it

    any help would be great.
    Attached Files Attached Files
    Last edited by spanker; 04-29-2009 at 12:16 PM.

  2. #2
    Registered User
    Join Date
    04-25-2009
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: if cell x> 0 then copy range of cells

    could you provide a sample of the spreadsheet?

  3. #3
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if cell x> 0 then copy range of cells

    just uploaded

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: if cell x> 0 then copy range of cells

    Here's a NON-array, non-VBA technique. It uses as KEY on the main sheet to number the rows that have a QTY greater than 0.

    Then on the Order Form, it uses a standard INDEX/MATCH against its own key column to bring over the matching data from matching keys. All in realtime.

    Once it's all working, you could hide the key columns if desired.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if cell x> 0 then copy range of cells

    thanks for the quick reply

    it sort of does what i want but can it remove the selections if there not selected? sort of like a shopping basket/add to cart

    ive uploaded the actual workbook ive been working on so you can see waht im trying todo.

    thanks
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: if cell x> 0 then copy range of cells

    Yeah, your results sheet leaves much to the imagination...not an actual "looks like this" example, so I'm guessing here.
    Last edited by JBeaucaire; 04-27-2009 at 07:33 PM. Reason: removed attachment, see next post

  7. #7
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if cell x> 0 then copy range of cells

    sorry it was a bit vague
    ive uploaded the sheet with the desired output on the mats order, if they are selected on sheet1 the corresponding details should be transfered to the mats order sheet and removed if deselected.

    im trying to make it so i only have to edit sheet 1 which will transfer the relevant details to the other sheets.

    thanks.
    Attached Files Attached Files

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: if cell x> 0 then copy range of cells

    Ok, this will sort your list for you. Notice the hidden key columns in the black margins on both the Sheet1 and the mats order sheet? These are used to create unique matching row info to draw the items over.

    I installed a User Defined Function called IFERROR, it's a function builtin to Excel 2007. This allows me to try and INDEX/MATCH the first set of items, and when an error occurs, the second formula kicks in and tries again on the second set of item.

    Once you see how it's working, you can color the font of the key columns (currently red letters) back to black so they disappear from view.
    Last edited by JBeaucaire; 04-28-2009 at 05:19 PM. Reason: Sheet removed...see below for latest version

  9. #9
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if cell x> 0 then copy range of cells

    Thanks JBeaucaire

    thats just what im after,

    but the data thats fetched from sheet1 in the first table only seems to bring the ref column data over to all the corresponding columns in the mats order, the other table works great, but the formulas look the same i cant seem to see any difference.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: if cell x> 0 then copy range of cells

    My bad, the formula for K21 is supposed to be:

    =IF($B21>$B$20,"",iferror(INDEX(Sheet1!$E$21:$E$42,MATCH($B21,Sheet1!$A$21:$A$42,0)),INDEX(Sheet1!$L$21:$L$42,MATCH($B21,Sheet1!$Q$21:$Q$42,0))))

    I highlighted the part that was wrong. In and INDEX/MATCH formula, the part that is "indexed" is where the answers are returning from.
    Attached Files Attached Files
    Last edited by JBeaucaire; 04-28-2009 at 05:19 PM.

  11. #11
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if cell x> 0 then copy range of cells

    if you select other item 3 from the second table (insect) in the order column in sheet 1, it brings the corresponding data from sheet 1 (Ref Qty Description Price Order Total) etc into mats order,

    but if you select item 5 from the first table (rodent) in sheet 1 it populates the rows in mats order with the data from the ref colum in item 5

    hope i explained it a bit better.

    thanks.

  12. #12
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if cell x> 0 then copy range of cells

    that did it

    you really are a rocket scientist!!

    thanks for all your help

  13. #13
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: if cell x> 0 then copy range of cells

    Last tip for you...notice how I UNMERGED all those merged cells on the mat orders sheet? Merged cells interfere with a LOT of useful functions in Excel, not the least of which is simple copy/paste functions. And it's unnecessary.

    To get the same appearance as a merged set of cells, select the cells and hit CTRL-1 > Alignment > Horizontal > Center across selection.

    ==============
    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED]

  14. #14
    Registered User
    Join Date
    04-25-2009
    Location
    Manchester,England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if cell x> 0 then copy range of cells

    I shall use that tip in future.

    thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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