Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

(Google Sheets) Matching cell values with a partial search AND returning first non-zero value?

$
0
0

Having issues trying to set up the right formula to find the first instance of a partial match that has an associated non-zero value. Basically, I have a project that logs estimated and actual hours worked by role. If a role has no estimated hours but does have actual hours, it needs to be rolled up into the lines with actuals OR display in a separate line under the role variation that does have actual hours.

The reference tab is formatted like:

NameRoleEstimated Hours NeededActual Hours Worked
DirectorAmanda020
DirectorBob025
Director Associaten/a500
SecretaryKathy030
Secretary jnrn/a400

But, I need to collapse the rows since no "Director Associate" or "Secretary jnr" worked on the project; those estimated hours instead need to be put on Amanda's and Cathy's lines since they were the ones who worked on the job. The main tab needs to be formatted like:

NameRoleEstimated Hours NeededActual Hours Worked
DirectorAmanda5020
DirectorBob5025
SecretaryCathy4030

I think also acceptable would be:

NameRoleEstimated Hours NeededActual Hours Worked
Directorn/a500
DirectorAmanda020
DirectorBob025
Secretaryn/a400
SecretaryCathy030

Easy enough to get names and roles but I cannot figure out how to do a partial search of the title PLUS the first non-zero value. In Amanda's case, I need to do a partial match search for "Director" and pull the first non-zero value for roles that include "Director" (in this case, it would be 50 hours under "Director Associate"). I tried and index/match with &"*" but the problem is "Director" doesn't have any additional characters after it, so it wouldn't be helpful in a use case where "Director" has the first non-zero value.

Including an example sheet here with some notes on what I've tried and found:https://docs.google.com/spreadsheets/d/1M0DO0lh3V1dDHcSBCZlE4ty7Y2TWJ0zLKWGlQSztHa0/edit#gid=0

Summary of notes:

  • Adding a &"*" at the end of my search doesn't work since the mid-tier seniority titles don't have additional strings after (ie, Art Director vs. Art Director jnr)
  • I'm unable to collapse roles with VLOOKUP but I set it up in the sheet anyway since it might help with referencing (I'm not as comfortable with index/match but it seems like it might be the way to go)
  • Creating a pivot table gets me the closest to what I'm looking for, except I can't collapse the roles, which is key

I came across this formula =INDEX($B$1:$I$1,MATCH(TRUE,INDEX(B2:I2<>0,),0)) in my research but I'm not sure how to apply it to the dataset I have since I need to be able to reference another sheet.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>