IF Command: Depending On This Value

May 21, 2009

I have a sheet in which I have a sum then depending on this value I want the next cell, F4, to have one of four outputs

If the value in F3 is;
Less than 1 F4 should show 9
between 1 and 2 F3 should show 16
Between 2 and 3 F3 should show 25
Greater than 3 F3 should show 36.

I have used IF to get the correct result when F3 is less than one but cannot work out how to add the other three results.

View 3 Replies


ADVERTISEMENT

Insert Formula Depending On Cells Depending Of Variables?

Jan 27, 2014

In a macro I want to automatically insert a formula in several cells. The formula depends on other cells, and I want to be able to manipulate these cells with variables. Here is my code:

[Code] .....

All my variables are declared:

Sheets("DATOS YTD 2014").Cells(I, Semana + 1) is the cell I want to be able to chose due to the variables
Sheets("DATOS YTD 2014").Cells(I, 3) is the reference cell for the VLOOKUP formula, that will vary with I
SheetMonth.Range("B3:W172") is a range in the sheet SheetMonth which is fixed

The error message I receive is the following: "Run-time error 13, Type mismatch"

I precise that the next step is to make the ",6," part in the vlookup formula also variable... but I guess once my current issue is solved this one will be a piece of cake.

View 3 Replies View Related

Press Command But And Execute The Code Assigned To Another Command Button

Apr 14, 2009

Is it possible that when you press a command button, that the first thing it does is to execute the code assigned to another command button (IE in another sub).

View 9 Replies View Related

Shell - Adding Another Command To Forfiles Command?

Apr 19, 2014

I am playing around with the Forfiles command (being called from Excel via Shell)..

I can't for the life of me get it apply a second command (such as getting the file size of each file)..

For example:

VB:
Private Sub CommandButton1_Click()
Dim Z
Z = Split(CreateObject("wscript.shell").exec("cmd /c forfiles /P C:UsersapoDesktopTextFiles /S /M *.* /d

[Code]....

The end result being the filename and the filesize shown..

View 4 Replies View Related

Excel 2007 :: Using Search Command With IF Command

Jun 20, 2013

Excel 2007

I have this simple formula: =IF(SEARCH("ABC",BQ239,1)>0,"Found", "Not Found")

Instead of saying Not Found when the value is not in the cell BQ239 text string I get #VALUE! returned

how do I get it to say "Not Found"? I searching for a substring that can be anywhere in the string.

View 2 Replies View Related

What Command Is Executing Or What Was Last Command Used

Feb 17, 2010

Is there any way to tell (from VBA) what GUI command is currently in progress or what the last command used was?

On a wish list perhaps: Application.LastCommand and/or Application.CurrentCommand

Let's say I'm in the "Sheet_Change" event and want to know what caused the change. Was the event triggered by "Delete", "Paste", "Keystrokes" ...

AutoCAD VBA has "Begin_Command (CommandName as String)" and "End_Command (CommandName as String)" events which I find very useful. Basically I'd like to emulate that to the greatest extent possible.

Application.Caller does not seem to work for the stated purpose. I've been searching for a workaround by means of reading the "Undo Stack". Numerous articles written by experts state that the undo stack is not accessible from VBA.

I've considered reading the text from the "Undo" button's caption but it just seems like such a hack ... not that this whole idea isn't a hack

View 9 Replies View Related

Command Button Name / Sort By Command Button

Feb 3, 2010

How can I return name of a command button on click? I want to create some sort buttons on a sheet I will use regularly to speed things up. I thought if I could call each sort button by the column letter the button sits in I can use this in a single sub for all buttons

e.g the button sitting in column A is called "A". when i click the button, it returns it's name to a variable which I can then use to sort column A. I know I could create a seperate routine for each button but I was just trying to think of something neater.

View 2 Replies View Related

Run Command Button Click From Another Command Button

Aug 31, 2007

I have a userform with a button on it named But1. Is it possible to store But1 into a variable then activate the But1_Click action using a variable?

Dim strButname As String
strButname ="But1"

Now, how would you activate the But1_Click method using strButname variable. With listboxes you can use the Control(strListboxName) methodology?

This doesn't work, but gives you an idea of what I am trying to do.

Controls(strButname)_click

View 9 Replies View Related

Menu Available Depending On Yes Or No?

Dec 5, 2013

Can I make a drop down list only available if another cell contains a Yes.

example :

A1 has a Yes/No drop down list by data validation

If A1 = yes then B1 gives the option of another Yes/no drop down list. If A1=No, or blank, then B1 has no menu option.

View 12 Replies View Related

Getting Value Depending On Changes Of 2 Cells

Jul 10, 2014

I have an issue with this for a couple of days actually..

I have to find in a certain date "column C" if User "column D" changes from the initial user's number to another one to gave me the first half sales of the day and then obtain the other sales of the other part, this must reestart again when the date changes.

I have to know what was the sales on the two parts of the day and then in column Q assign "Manana", S1 Cell or R1 Cell for second part of day

The User "column D", can be diferent each day.

I attach the excel data to get a better explanation on this.

Mov may-jul FARMAX.xlsx

View 7 Replies View Related

Formula Depending On A Value

Mar 2, 2010

i have a sheet which is being used as a payment advise with subsidies.
depending on the product selected, it is either a $value multiplied by the qty or a % of the total value.

what i am trying to do as an example:

if cell F46 = percent(or sheet2 b6) it needs to multiply by cell H32

BUT if cell F46 = $ (or sheet2 B7:B11) it needs to multiply by cell B46

(sheet 2 has named ranges to be used in a list box)

View 9 Replies View Related

Sum Depending On Other Columns

May 15, 2007

I want to create a macro that make the somme of 2 other columns when the nummer of the first column ist double(more than one ) and put the somme in a new Rows. like this :

A C
23 5
23 12
23 2
45 4
45 1
46 3

in the news the resultat in the same columns it´s like this
A C
23 19
45 5
46 3

I got this code , but I work only for news colums , A and B

Sub test()
Dim a, i As Long, b(), n As Long
a = ActiveSheet. Range("a1"). CurrentRegion.Resize(, 2).Value
Redim b(1 To UBound(a, 1), 1 To 2)
With CreateObject("Scripting.Dictionary")
.CompareMode = vbBinaryCompare
For i = 1 To UBound(a, 1)
If Not .exists(a(i, 1)) Then
n = n + 1: b(n, 1) = a(i, 1)
.Add a(i, 1), n
End If
b(.Item(a(i, 1)), 2) = Val(b(.Item(a(i, 1)), 2)) + Val(a(i, 2))
Next
End With
ActiveSheet.Range("d1").Resize(n, 2).Value = b
End Sub

View 9 Replies View Related

Cell That Changes Depending On Month

Mar 4, 2009

I'm trying to get the pink cell in THIS sheet to match up with the correct MONTH'S TOTAL in the pink highlighted column in THIS sheet. i couldnt figure out how to explain it any clearer.

View 6 Replies View Related

Row Color Depending On Cell Value

Sep 3, 2009

I was wondering if it is possible to fill a row with a color depending on the value of a certain cell. Say, if the value of cell N5 is 0 then row 5 turns red.

View 3 Replies View Related

Summing YTD Depending On Month?

Oct 1, 2009

I have a spreadsheet with a year’s worth of data in. The columns are months (Jan, Feb, Mar etc) and the rows are people (A, B, C etc). There is a YTD column at the right.

I will be updating a cell at the top with the current month.

I want to be able to sum the YTD figures depending upon the date at the top. For example, the date at the top is Aug, so I want to sum Jan to Aug, if I change the date to Sep then I want to sum Jan to Sept. This way I will be able to automatically calculate YTD on a pre-populated spreadsheet, just by changing the date each month.

View 5 Replies View Related

Ranking Depending On Several Factors?

Dec 7, 2012

I have to make a hierarchy of my employees, taking in consideration the achievemnt of their target. I'll attach a sample to make it simple to understand. The are 2 classes of factors: Class I and Class II.

- In Class I (witch counts 75% in total results) there are:
- New deposit - count 75% from class I
- Insurance - count 10% from class I
- Investments fund - count 15% from class I
- In Class II (witch counts 25% in total results) trere are:
- Loan A - count 15% from class II, but the number have a weight of 40% in results, and volume 60%
- Loan B - count 75% from class II, but the number have a weight of 75%, while volume have 25%
- New clients - count 10% from class II

Now, I have to rank the employees taking in consideration the Deviation for all of the factors above (columns E, H, K, P, Q, V, W, Z).

View 3 Replies View Related

Use Same VBA Macro Depending On Cell Name

Jan 30, 2014

[Code] .....

But what I want to do now is to strikethrough to eliminate unwanted data when a particular option is selected from the drop down list. In this case ( If User choose "Mens" for Gender, and NOT "Pants", Then Strike though the Result "NIKE". This works for the template in column E only using this code.

[Code] ...............

I tried to modify this like

[Code] ...............

So that every time x changes, the condition changes, but it seems like I cant do, Range("NIKE_" & x).

Attached File : Test1-2ed.xlsm

View 2 Replies View Related

Add Data To Row Depending On Combobox?

Feb 21, 2014

Basically I have a column filled with names (A) that the combobox is filled with, I then have a text based inputbox and a submit button. Right now the submit button transfers the data from the inputbox to the same row depending on the combobox choice and edits the existing text which is fine.

However I also want the data to be submitted to another sheet where the data is not edited but added.

Example: I choose James from combobox and writes 10 in the inputbox, the submit button will then edit the existing value on the "Data Edit" sheet on the row James and add the value to the row James on the "Data Add sheet".

This is the edit code, I basically just need some pointers as to how to add data to blank cells in corresponding rows according to combobox selection.

[Code] .....

Attached File : Combobox Row Add.xls‎

View 4 Replies View Related

Hide Row Depending On Cell Value?

Mar 24, 2014

I would like to run a macro that searches column [AS] and hides any rows in that column that contain "0".

View 6 Replies View Related

Separating The Records Depending On The Value

Dec 22, 2008

I have attached 2 spreadsheet :-

1. BounceBackMaster.xls
2. BouncebackMails.xls

I need to excute the macro from master file asking the input file. Input file will be the Mails spreadsheet. In the master spreadsheet there will be "TAG" column, depending on value it need to check the value in the Mails spreadsheet "MessageContent" column after subject value. It need to group all tAG value, each sheet need to be created with TAG value and related need to be copied from "BounceBack" sheet to created sheet.

Example:

Step 1 :- Macro is executed from "BounceBackMaster.xls" and asked for input file, input file will be "BouncebackMails.xls"

Step 2 :- From "BounceBackMaster.xls", First TAG value will be readed " Monthly Account Statement" is check in "BouncebackMails.xls"........

View 3 Replies View Related

CASE Depending On Target Value

Jan 20, 2009

How would I set up a series of CASES depending on the Target.Value (a doubleclick code within spreadsheet) such that IF target value isblank, then change to Ö. If target value is Ö, then change to "NA". If target value is "NA" then clear contents
Would CASE be the best way to go or a series of IF's?

View 3 Replies View Related

List Box Depending On Combobox

Jun 2, 2009

I would like to add a combobox and would like to add/delete items to the list box.

View 9 Replies View Related

Color After Depending On 1st Value In A Cell

Jul 3, 2009

I have another macro request.

I would like to ‘grey out’ a certain qty of cells depending on the 1st number in another cell. So 1st of all it would have to check in column B to see if there is any data and then check for the first number in that cell (there will be many numbers in the cells but we only need the 1st one (Ex.: B3 = “3 / 8 & 8”).

Then it should start counting from column D the found number of cells multiplied by 2.

Ex.: if Cell B3 contains “3 / 8 & 8” it will count 3 x 2 = 6 (3 cells x 2 = 6 cells)

Then, if after that count (now at I3), in the next cell over (J3) if the is data in the cell above (J2) then it should apply an Interior.ColorIndex of 15 for the next cells until there is no data in the cells above (if nothing after K2 the grey will be applied to cells J3 & K3 only).

View 14 Replies View Related

Duplicate A Box Depending On How Many Rows Another Tab Has.

Nov 16, 2009

I need a macro to duplicate a box i have in a sheet depending on how many rows the other tab has. In this example file ive included the macro i have now. With this macro i select A1 : R23 and press ctrl shift d, it asks me how many duplicates i want and i enter the number based from how many the test2 tab has. I would like a macro to read how many rows the test2 tab has and then automatically duplicate the box that many times . In other words automate it, instead of me having to enter the number ( this number changes depending on the file i have ).

Ive included a test file with intructions and my current macro, i have 2 tabs which need to be looked at.

View 5 Replies View Related

Changing Colour Depending On Value

Dec 1, 2007

it is possible to change the colour of a cell text and / or cell background depending on a value.

For example I have currently 2 cells with numbers in
G3 = 4.38
K3 = 8.68

What I wolud like to happen is for the cell with the lowest value to change to Red.

The Column letters will always remain the same but I do plan to add a lot more rows.

View 10 Replies View Related

Sum Numbers Depending On Their Source

Mar 25, 2009

I need to sum numbers depending on their source. Consider the following sources


Source .....................#
M D11 24 ......... 5
M D11 23 ......... 6
M D02 25 ........ 7

I want sum of all numbers whose source has D11 in its name (Answer 11). What's the best way of doing so?

View 5 Replies View Related

Email Depending On Condition?

Dec 21, 2011

I've got a live data feed linked to my worksheet and I've got some macros doing some calculations over that fed data.

And I've got this final decision table which is building up over time and telling me to buy or sell

_______ A _______ B ________ C
1_____ Time _____ Buy ______ Sell
2____ 08:10 ______ 0 ________ 0
3____ 08:18 ______ 0 ________ 0
4____ 08:22 ______ 1 ________ 0
5____ 08:35 ______ 0 ________ 0
6____ 08:45 ______ 0 ________ 1
7____ 09:15 ______

Is there any chance I can get an email the moment 1 prompts in column B or in column C? I would prefer it to check the figures every 2 or 3 seconds..

View 9 Replies View Related

How To Run A Cell Formulated Depending On Value Of Another

Oct 30, 2013

In three cells selected from a sheet, use the "MIN" to calculate the minimum value of the values ​​of these three cells. After calculating the minimum value, apply a conditional formatting cell and it is colored green.

What I need is that, once established the minimum value in another column and cell specific, run a specific formula, taking into account: If the minimum is in a column X, and Y in a row, the formula should run only on the cell that is in the X -2 column, row Y-1 (two columns less and less row, where it is the cell whose value is the calculated minimum).

Example : if the minimum is in the cell " K24 ", the " Formula 1" must be executed in Cell "I23", if this minimum calculated were within the cell "H24", the "formula 2" must be run on the cell "F23" and if the minimum was in cell "E24"​​, the "formula 3" must run "C23".

View 4 Replies View Related

Set Range Depending On Value In Column D

Oct 29, 2007

I have a list of data in colum A and I want to group them together.

In column D I number the group with the same number.

A1 = Tony D1 = 1
A2 = Tom D2 = 1
A3 = Bill D3 = 1

A4 = Helen D4 = 2
A5 = Marg D5 = 2
A6 = Kathy D6 = 2
A7 = Catherine D7 = 2

And so on..... The list up to 100 names

As you can see group 1 = 3 names, group 2 = 4 names, group 3 = 6 or maybe 7 and so on.

I'm trying to set ranges for them Eg:
set rng1 = A1:A3
set rng2 = A4:A7

but it not fixed to set ranges like that. It's variable and changes every week. Next week maybe rng1 = A1:A5, rng2 = A6:A9.

can I have the VB code to determine these variable ranges.

View 9 Replies View Related

Message Box Depending On Cell Value

Aug 29, 2008

What i want is for a message box to appear automatically when the workbook is opened ONLY if Cell C4 (which is merged to F4)...

If there is information in this box then do not run macro

in the message box I want a box you can type in that will enter that information into cell C4. I know I will have to us a user form but what is the code I need?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved