+ Reply to Thread
Results 1 to 4 of 4

Best way to make a long if statement?

  1. #1
    Registered User
    Join Date
    04-27-2009
    Location
    New York, New York
    MS-Off Ver
    Excel 2003
    Posts
    25

    Best way to make a long if statement?

    I have about 30 seperate unique codes for various different revenue accounts. The codes are 4 cells to the left of each total revenue number (which is the number i want to pull). I also have a report that has the the revenue account name and what should be the total revenue number in the cell next to it. Let's say the code for "Revenue Account A" on the Report worksheet is T29D and the code for "Revenue Account B" is G56W. If the codes were in column J and the revenue amounts were in column F, I would want the formula where the total revenue number should appear to say If(J14="T29D",F14,If(J14="G56W",F14,If(...... And so on down the line for those 30 codes. What is the best way to do this. It does not necessarily have to be and if statement, I just thought this would be the only way to achieve the desired results. Any input is appreciated.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Best way to make a long if statement?

    Are you pulling amounts for different codes into one cell or just trying to sum separately for each individual code?
    Audere est facere

  3. #3
    Registered User
    Join Date
    04-27-2009
    Location
    New York, New York
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Best way to make a long if statement?

    I am going to drag the formula all the way to the bottom of the spreadsheet so each cell with the formula should have a different revenue amount depending on whether or not it found the appropriate code in column J (just one number in each cell, not multiple numbers in one cell)

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Best way to make a long if statement?

    OK, I think I understand. If you have the codes in a list then name that list "CodeList" and then use this formula in row 14 copied down

    =IF(COUNTIF(Codelist,J14),F14,"")

    Then you can sum that column for the total

    Alternatively you could probably get the total in one go with this formula

    =SUMPRODUCT(SUMIF(J:J,Codelist,F:F))

    If you don't want to name the list of codes you could just use the cell references of the list in either of those formulas

+ 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