+ Reply to Thread
Results 1 to 11 of 11

Can I use the "IF" function to combine values in different cells?

  1. #1
    Registered User
    Join Date
    05-17-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2010
    Posts
    5

    Can I use the "IF" function to combine values in different cells?

    Hi everyone. Here's my spreadsheet and what I'm trying to do:
    oddppic.png
    I want to make a formula for the cells in column B that will return the charge based on the "charge type" that I enter in column C. I'm not very savvy with excel, but I managed to put together the highlighted formula that works okay as long as there is only 1 charge type. Is there a way to modify the formula so it will combine the charges of multiple "charge types"? For example, I want the formula to return 28 in C4 and 29 in C6. Any help would be great!

  2. #2
    Registered User
    Join Date
    05-17-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Can I use the "IF" function to combine values in different cells?

    Here's the actual workbook instead of just a picture of it: ODDP_Spreadsheet_test.xlsx

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

    Re: Can I use the "IF" function to combine values in different cells?

    Please attach a sample workbook for working and giving exact solution


    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

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

    Re: Can I use the "IF" function to combine values in different cells?

    Add the below code in module.

    Please Login or Register  to view this content.
    Refer the attached file for details
    Attached Files Attached Files

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Can I use the "IF" function to combine values in different cells?

    to begin with, you can use a vlookup instead of your nested if's...
    =VLOOKUP(C2,$E$2:$F$7,2,FALSE)
    copied down.

    I am working on the combinations, how many would you expect to have - max?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Can I use the "IF" function to combine values in different cells?

    OK if you can split out the different rates, its easy. Use that same vlookup I suggested, wrapped in iferror() and copy it down and across...
    =IFERROR(VLOOKUP(C2,$H$2:$I$7,2,FALSE),0)

  7. #7
    Registered User
    Join Date
    05-17-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Can I use the "IF" function to combine values in different cells?

    Quote Originally Posted by :) Sixthsense :) View Post
    Refer the attached file for details
    Thanks, your code does exactly what I wanted. I have no experience creating functions though so I have no idea what the parts of your code mean. Can you direct me to a tutorial or guide that would help me understand so I can recreate something similar if I need to?

    Quote Originally Posted by FDibbins View Post
    OK if you can split out the different rates, its easy. Use that same vlookup I suggested, wrapped in iferror() and copy it down and across...
    =IFERROR(VLOOKUP(C2,$H$2:$I$7,2,FALSE),0)
    Thanks for your formula too. I've never used vlookup before, and it sure helped a lot to simplify things. Is there any way I can use it to combine charges when multiples are used instead of displaying 0? Here's the spreadsheet with your formula:ODDP_Spreadsheet_test2.xlsx

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Can I use the "IF" function to combine values in different cells?

    I am working on the combinations, how many would you expect to have - max?
    Can you answer that 1st?

  9. #9
    Registered User
    Join Date
    05-17-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Can I use the "IF" function to combine values in different cells?

    Quote Originally Posted by FDibbins View Post
    Can you answer that 1st?
    Oh sorry. I don't think I'll have more than 5 charge types used at once. So a max of 5 combinations, if that's what you're referring too.

  10. #10
    Registered User
    Join Date
    05-17-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Can I use the "IF" function to combine values in different cells?

    Quote Originally Posted by ataulfo View Post
    Oh sorry. I don't think I'll have more than 5 charge types used at once. So a max of 5 combinations, if that's what you're referring too.
    And actually 5 would be super unlikely. We could assume a max of 3 if that makes things easier.

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Can I use the "IF" function to combine values in different cells?

    take a look at the attached. its not pretty but it works, and you can expand it without too much problem - I set it up for 6 letters.

    You can hide H:M if you want. Also, I created a range name for the vlookup table, if you need to expand the range, add the data you need, and then go into Formula/Define Names/Name Manager, find the range name "Charges", dbl-click and adjust the range as needed
    Attached Files Attached Files

+ 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