Make a formula return a different text when I click on a cell outside of a specified range. (??)

edge37

Board Regular
Joined
Sep 1, 2016
Messages
102
Office Version
  1. 365
Platform
  1. Windows
Hello! Given the sample included, I use a VBA code to show the active cell value in a cell (cell AM5), also I need to use the formula:
Code:
=IF(AM5>=91,"Advanced",IF(AM5>=80,"Excellent",IF(AM5>=70,"Needs improvement",IF(AM5<70,"Invalid"))))
so when I click in a name of a student, it returns one of the texts included in the formula based on their grades. The thing is that if I click a blank cell or any other one that is not any of the student's names, it still shows the text "Invalid" because a blank cell is also less than 70.

Is there a way to include something to limit this formula to work only in a range of specified cells (only when i click any student's name) and, if I click another cell outside that range, a specified new text would appear (like "name?" or whatever I choose) in the target cell. Can't figure out this one.

Thanks, and I hope I could describe my problem clearly.
 

Attachments

  • Screenshot_2.jpg
    Screenshot_2.jpg
    19.1 KB · Views: 8

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try this:
Excel Formula:
=IF(AM5<>"",IF(AM5>=91,"Advanced",IF(AM5>=80,"Excellent",IF(AM5>=70,"Needs improvement",IF(AM5<70,"Invalid")))),"name?")
 
Upvote 0
=IF(AM5="","?name",LOOKUP(AM5,{0,70,80,91;"Invalid","Needs Improvement","Excellent","Advanced"}))
 
Upvote 0
Try this:
Excel Formula:
=IF(AM5<>"",IF(AM5>=91,"Advanced",IF(AM5>=80,"Excellent",IF(AM5>=70,"Needs improvement",IF(AM5<70,"Invalid")))),"name?")
Thank you, unfortunatelly, when I tried it, it still won't work the way I want. When I click another cell that is not the range of names, it always says "invalid", doesn't show "name?"
 
Upvote 0
=IF(AM5="","?name",LOOKUP(AM5,{0,70,80,91;"Invalid","Needs Improvement","Excellent","Advanced"}))
Thank you, unfortunatelly still don't work for me. Maybe there could be a way to define in which range of cells it will work and outside of that range it would show a defined text.
 
Upvote 0
How is this not doing what you want? If this isn't it, can you explain further?

Cell Formulas
RangeFormula
AN5:AN8AN5=IF(AM5="","?name",LOOKUP(AM5,{0,70,80,91;"Invalid","Needs Improvement","Excellent","Advanced"}))
 
Upvote 0
We could benefit from seeing your entire code, as well as the actual sheet using the XL2BB add in, or alternatively if you could share your file via Google Drive, Dropbox or similar file sharing platform. Without that, I'll step out of this thread for now.
 
Upvote 0
DUMMY.xlsm
ABMNOPQRSTYZAAAB
3FORMULAS
4
5#N/A#N/A#N/A
6
7#N/Akevin9999's formula
8#STUDENT1010X27%45%100%
91ETT0033336$A$3#N/AScott Huish's Formula
102E5YEH0022224
113EG55EG00264470
124G5E00275582
135DFER009191
10A (1)
Cell Formulas
RangeFormula
Y5Y5=VLOOKUP($T$8,$B$9:$R$15,15,FALSE)
Z5Z5=VLOOKUP($T$8,$B$9:$R$15,16,FALSE)
AA5AA5=VLOOKUP($T$8,$B$9:$R$15,17,FALSE)
Z7Z7=IF(AA5<>"",IF(AA5>=91,"Advanced",IF(AA5>=80,"Excellent",IF(AA5>=70,"Needs improvement",IF(AA5<70,"Invalid")))),"name?")
T9T9=CELL("address")
Z9Z9=IF(AA5="","STUDENT?",LOOKUP(AA5,{0,70,80,91;"Invalid","Needs Improvement","Excellent","Advanced"}))
P8P8=SUM(C8:N8)/100
P9:P13P9=(C9+D9+E9+F9+G9+H9+I9+J9+K9+L9+M9+N9)
R9:R13R9=SUM(P9:Q9)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
Y4:AA7,Y3Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
C9:N15Cell Value=0textNO
B9:R15Expression=IF(AND($T$9 = "$B$" & ROW(B9), ROW(INDIRECT($T$9)) = ROW()), 1, 0)textNO
R9:R15Expression=ISODD(ROW())textNO
P9:Q15Expression=ISODD(ROW())textNO
M9:M15Expression=ISODD(ROW())textNO
A9:L15Expression=ISODD(ROW())textNO
O9:O15Expression=ISODD(ROW())textNO
N9:N15Expression=ISODD(ROW())textNO
R9:R15Cell Value<70textNO
AA5Expression=IF(ISBLANK(B1),"0","")textNO
Y5:Z5Expression=IF(ISBLANK(C2),"0","")textNO
Z5Expression=IF(ISBLANK(A1),"0","")textNO
 
Upvote 0
I also use a VBA code
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Range("T8").Value = ActiveCell.Value
End Sub
 
Upvote 0
How is this not doing what you want? If this isn't it, can you explain further?

Cell Formulas
RangeFormula
AN5:AN8AN5=IF(AM5="","?name",LOOKUP(AM5,{0,70,80,91;"Invalid","Needs Improvement","Excellent","Advanced"}))
Thanks again, but I cannot make it work like I want it over here. maybe it is my lack of experience. From the mini sheet included above, when I click a student's name, the classification appears according to their grades in cell Z9, but I'd like this to work only in a range I can specify (student's names for example), so if I click any other cell, blank cell or else, outside that range, the phrase "name?" (or anything else I want) would appear instead.

Not sure if I could explain myself better this time.

thank you again
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top