excel formula for selecting on large # of possiblities with 3 possible results

erin7823

New Member
Joined
Sep 9, 2014
Messages
4
Hello, this is my first post on anything so here goes.

<style type="text/css">P { margin-bottom: 0.08in; }</style> column G represents a range of values (i.e. 10 to 90) of which I'm trying to key on one of several possibilities; ( 12,13,19,24,60,61,62,63,64,65,66,67,68,or 72)



columns C and M represent values ($0.00 to $x.00), either C or M but not both may hold a value in the same row


as an example:
if column G=64 and C<>0, I would like column X to result in C's value;


if G=64 and C=0, I would like column X to result in M's value;


if column G does not match any of the selected values, column X should result in a blank


Thank you in advance for any assistance in this problem.
Erin
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

StephenCrump

Well-known Member
Joined
Sep 18, 2013
Messages
3,806
Office Version
  1. 365
Platform
  1. Windows
Welcome to MrExcel!

Perhaps something like:

Excel 2010
ABCGMX
1Target values111211
21222
313336433
41944
524
660
761
862
963
1064
1165
1266
1367
1468
1572

<tbody>
</tbody>
Sheet1
Formula in X1: =IFERROR(IF(MATCH(G1,A$2:A$15,0),C1+M1),"") copied down the column.

This relies on either C or M being blank. I'd prefer to put in a check:

Formula in X1: =IFERROR(IF(MATCH(G1,A$2:A$15,0),IF(OR(C1=0,M1=0),C1+M1,"M and C are both non-zero")),"")
 

erin7823

New Member
Joined
Sep 9, 2014
Messages
4
Thanks for the quick followup Steven. I entered the formulas, but I didn't understand them and may not have entered them correctly. Any one of my range of numbers could appear in each row of column G. Does (g1,a%2:a$15,0) represnt an array? I apologize but my lack of experience at this point has melost. marshall
 

erin7823

New Member
Joined
Sep 9, 2014
Messages
4

ADVERTISEMENT

Have a play with this: https://app.box.com/s/th2uhxc72rcrffmwuoop

Is it close to what you're looking for?
Steven, C and M never have >0 values in the same row, so the addition of C+M is fine. the selection of key #'s appears to work from your example. I don't understand how this formaula could be put into the X cell if this an array thing, my ignorance.

It is early am here in USA/MD. but I want to try and hang with you as long as I can, Marshall

an update Steven, when a key value is not found in G, X should be blank or zero
 
Last edited:

StephenCrump

Well-known Member
Joined
Sep 18, 2013
Messages
3,806
Office Version
  1. 365
Platform
  1. Windows
an update Steven, when a key value is not found in G, X should be blank or zero

I think the spreadsheet I've posted does this? For example, G6 is 59, which is not in your list of keys, so X6 returns blank.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,359
Messages
5,528,222
Members
409,809
Latest member
VICKRAM

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top