+ Reply to Thread
Results 1 to 3 of 3

IF array formula almost works.

  1. #1
    Registered User
    Join Date
    03-01-2015
    Location
    Southport, Florida
    MS-Off Ver
    2010
    Posts
    2

    IF array formula almost works.

    I've been able to create a CSE array formula that allows me to add up individual values listed to the right of specific words in a range.

    Here is an example I'm making up off the top of my head:

    Let's say I assign these categories numeric costs, say for a game. So, if I were to "purchase" certain types of things for a simulation:

    There are three tiers, each one a subset of the lower tier, and each one assigned an absolute "cost". So

    First tier costs 1 point
    Second tier costs 2 points (plus the 1 point for the lower tier)
    Third tier costs 3 points (plus the 3 points for the lower two tiers)
    Costs are cumulative.

    You'd only have to pay once for each uniquely named tier.

    For example

    Collectibles

    A1: Treasure (tier 1) B1: Precious Metals (tier 2) C1: Gold (tier 3) [6 points]
    A2: Treasure (tier 1) B2: Precious Metals (tier 2) C2: Silver (tier 3) [+ 3 points. Note 2nd tier is the same.)
    A3: Treasure (tier 1) B3: Art (tier 2) C3: Tapestry (Tier 3) [+ 5 more points. Note that 2nd tier is different, increasing cost)

    Total Point Cost: 14

    I've created a formula that searches for each unique instance of the word in the 1st tier, and then adds up the point value of the 2nd and 3rd tiers along the same row. The user may enter whatever word they'd like for each tier, leading to a lot of random possibilities and combinations.

    My formula works right now...except for one critical flaw. I can't figure out how to get it to EXCLUDE the second instance of any unique word at any of the three tiers. In other words, my sheet would calculate the above as 18. The named cells are not predetermined. But allowing the user to enter any word desired (it's for a game), means I've reached the limits of my ability to design this sheet.

    Here's an example of the formula that only accounts for the unique name in the 1st tier. Imagine I'd add the cost of each tier to columns D,E, and F:

    {=SUM(IF(A1:A3="Treasure",D1:D3+E1:E3+F1:F3))}

    Now how on earth do I exclude the second or subsequent instances of the 2nd and 3rd tiers from the formula without going into VBA? Am I going to run into an endless loop of if-then?

  2. #2
    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
    52,945

    Re: IF array formula almost works.

    Hi, welcome to the forum

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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

  3. #3
    Registered User
    Join Date
    03-01-2015
    Location
    Southport, Florida
    MS-Off Ver
    2010
    Posts
    2

    Re: IF array formula almost works.

    Ok, thank you. I have attached the file. It is a character generator for a tabletop role-playing game, but I used more mundane categories to describe what I'm trying to do in my first post. Here is the sheet I'm really working on.

    Stuff to ignore: The CP columns work the way I want and are just point costs.

    The part I'm having difficulty with it calculating the "Defense Pools" part of the sheet toward the bottom. If an Ability row (one of the rows up top) is just one row, it works great. If it is two rows (i.e one Ability multiple branches), that's where it is broken, because I don't want to count duplicate tiers twice.

    Ignore the whole "restricted" versus "unrestricted" stuff because that relates to the character build costs.
    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)

Similar Threads

  1. [SOLVED] IF formula in ARRAY = works <> doesn't work
    By bkanealy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-02-2014, 09:31 AM
  2. Array Formula only works if entered in more than one cell
    By Speshul in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-08-2014, 02:18 PM
  3. [SOLVED] weekday() result used in an array formula doesn't work. Formula works if i type in date
    By aarco50 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-25-2014, 03:25 PM
  4. [SOLVED] Array Formula works in one portion, but not after being altered and moved
    By kspeese in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-19-2013, 01:14 AM
  5. Inserting an array formula with VBA FormulaArray property works strange enough
    By Tchesko in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-27-2012, 11:32 AM

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