Limit the Value of a Cell to only Negative

Posted on 2012-03-28
Last Modified: 2012-03-29

I would like to limit the value of a cell to only be negative.  
I have a formula in this cell
=IFERROR(VLOOKUP("*Interest exp*",IncomeStmnt!$A$3:$L$56,2,0),0)

Therefore it is not a manuel entry.  
I know I can limit to only negative if I actually typed a number into the cell but this is not the case.

How can I limit the value of the cell to only negative if there is a formula in the cell?
Question by:pdvsa
  • 3
  • 3
  • 2
  • +1
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37776688
What should happen if the value is negative?
LVL 85

Expert Comment

by:Rory Archibald
ID: 37777085
Perhaps simply:

=MIN(IFERROR(VLOOKUP("*Interest exp*",IncomeStmnt!$A$3:$L$56,2,0),0),0)

Accepted Solution

Leo Torres earned 200 total points
ID: 37777238
The question is so what do you want to happen if the value is not negative.. Error message to user..

this would have to be done in VBA code..

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") Then
    If Range("A1").Value < 0 Then
   MsgBox ("Value must be positive")
    End If
End If
End Sub

Open in new window

LVL 85

Expert Comment

by:Rory Archibald
ID: 37777288
Worksheet_Change will not be triggered by a formula calculation though - you would need the Calculate event.

Expert Comment

by:Leo Torres
ID: 37777313
Good point rorya:

I im out of shape on VBA its been a while..

Thanks.. but the logic remains the same it should still work

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.


Author Comment

ID: 37781168
Sorry for my late reply.  I have been very busy with my "real" job.  I hope to test in a few hours when i am at a computer.   Thank you

Author Comment

ID: 37781428
Hi, I would rather not have a VBA enabled excel file (if possible).  A warning message is not absolutely necessary but it nice to have but I think the only way to have that is by VBA but what do I know (not much).  If the file is distributed, otheres will not know what to do when they get the enable macros security message.  

I am not sure if the formula by rorya changes the value to negative in cell:  (VLOOKUP("*Interest exp*",IncomeStmnt!$A$3:$L$56,2   if it was positive?

thank you.
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37781434
If you simply want the positive value of that number then you can use

=abs(IFERROR(VLOOKUP("*Interest exp*",IncomeStmnt!$A$3:$L$56,2,0),0))
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 300 total points
ID: 37781442
No, mine returns 0 if the value is positive. If you simply want to convert it to negative, then:

=-ABS(IFERROR(VLOOKUP("*Interest exp*",IncomeStmnt!$A$3:$L$56,2,0),0))

Author Closing Comment

ID: 37781717
I decided to award points to two experts.  I hope that is fair.   I did not say in my initial question I was not interested in VBA.   I thought of this afterwards.  Thank you.

Rorya:  that worked perfectly!

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to open excel file size more than 2 GB 3 43
Excel macro sheet auto run and save to xlsx 5 17
Splitting out Data 14 27
Excel 3 22
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now