+ Reply to Thread
Results 1 to 4 of 4

Need to Identify Blank Cell Locations, Index them, and Assign them values

  1. #1
    Registered User
    Join Date
    11-08-2019
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    7

    Need to Identify Blank Cell Locations, Index them, and Assign them values

    Hello

    Everyone was of great help last time I posted and I appreciate your efforts.

    Today I am working with some cost data and I need to do a few things

    1) Use a formula to count and identify which blank cells are being counted (Or cells that contain Y, more on that later). I have the number but need to be able to identify which of the cells are blank
    2) Once identified, Need to have them display or be able to assign them a value in a key
    3) Add the number of missing key values together to get a total cost

    On the attached sheet, I have a list of agents, missing states, and the cost per state. Ignoring the X's, I need to count the blank cells per line and identify the total cost per agent. Ex. Agent 1 has 5 missing states shown from the formula =COUNTIF(D2:BB2,""). I need a way to identify which of those 5 states are the ones missing and assign each of them to a key that has a specified cost. Once that is done, be able to add the costs together to get Total cost. I need to work with row 32 "Cost per State". Not sure if I am going to use Total cost in row 34 yet so you can probably ignore. Also Not really sure where to start with the Key so by all means please enhance or if you have any advice I would appreciate the help.

    This is a snippet from a real data set so the X's are states these particular agents don't need. I would like to have a way or an idea for a key I can use to mix and match different states so I can test 2 or 3 or 15 states to see what the total cost would be. Ex. If I'm looking at the cost of NY and OH, being able to add "Y" in the state column and have it pull the value of that state from the key into the equation. Whatever state has a Y would add the state to the equation and total cost would be something like If Y, reference the key below and pull that value and add any other states that have Y

    I added some additional notes and comments to the sheet to explain what I am trying to do. Please let me know if it needs more explaining.

    As always, appreciate your time and help
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-30-2019
    Location
    Bistrita, Romania
    MS-Off Ver
    2019; 365
    Posts
    231

    Re: Need to Identify Blank Cell Locations, Index them, and Assign them values

    Added a function called ConcatenateIf to the worksheet and used it in column BD to display missing states.

    For Total cost, wouldn't =SUMPRODUCT(--(D2:BB2="");$D$32:$BB$32) be okay? Instead of keys you could maybe add the cost directly?
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-08-2019
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    7

    Re: Need to Identify Blank Cell Locations, Index them, and Assign them values

    Thanks Mrrrr. This worked!

    I have a few follow up questions if you don't mind.

    On your concatenateif formula, you have it showing as comma + space. I don't see you entering " " in the formula. When I try to recreate it it is listed as AL,CO,IN without the spaces. if I add " " anywhere it won't make the formula work either. Just curious how you were able to add them in

    Also in =SUMPRODUCT(--(D2:BB2=""),$D$32:$BB$32) What does the -- do here? I assume D2:BB2="" is looking for the blank cells and then lining up the black cell to the corresponding $$ amount in row 32. D$32:$BB$32

    Thanks!

  4. #4
    Forum Contributor
    Join Date
    10-30-2019
    Location
    Bistrita, Romania
    MS-Off Ver
    2019; 365
    Posts
    231

    Re: Need to Identify Blank Cell Locations, Index them, and Assign them values

    No problem.

    This function is something I found online a couple of years back when I needed something similar to you. In the function (see Module 1 in VBA), there is an "Optional Separator As String = ", "", so adding nothing in the formula - leaving it as: =concatenateif(D2:BB2;"";$D$1:$BB$1) should do the same trick and leave , + space between states. I just added the separator in the end of the formula so you know where it is in case you want to change it.

    As for SUMPRODUCT, gonna quote another answer because I think it says it in the simplest way:
    Quote Originally Posted by martindwilson View Post
    Because conditional expressions return True or False rather than numbers they need to be coerced to numbers inside the SUMPRODUCT function. You can do this using two minus signs (--) or by adding 0 (+0) or by multiplying by 1 (*1). Using -- is very slightly faster than +0 or *1.

    read here
    http://www.decisionmodels.com/optspeedj.htm
    and here
    http://www.xldynamic.com/source/xld....T.html#explain
    Last edited by Mrrrr; 11-13-2019 at 05:04 PM.

+ 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] VBA/Formula to identify similar values in multiple rows and assign a name
    By Rajeshkumar2910 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-07-2017, 05:41 AM
  2. Macro to identify 0 and blank values and populate accordingly
    By The_Snook in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2015, 06:48 PM
  3. Identify multiple locations more than X miles apart
    By sshot1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2014, 01:51 AM
  4. How to Identify If an Array have blank or -ve values
    By mandukes in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-20-2013, 05:45 PM
  5. Replies: 3
    Last Post: 02-20-2013, 08:54 PM
  6. Copy values from populated cells only, and identify those cell locations.
    By The Machinist in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-19-2012, 07:02 AM
  7. Auto Assign Unique Values to Blank Cells
    By NSTurk725 in forum Excel General
    Replies: 6
    Last Post: 06-20-2009, 05:02 PM

Tags for this Thread

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