To Shorten An If Formula

Jul 28, 2008

My formula is:

=IF(E4="Break",D4,IF(H4="Break",G4,IF(K4="Break",J4,IF(N4="Break",M4,IF(Q4="Break",P4,0)))))

My problem is that excel only lets me use 7 IF functions and I need a total of 12. So I need a different way to perform that same function.

View 13 Replies


ADVERTISEMENT

Formula To Shorten An Alphanumeric Line Of Text

Jan 25, 2010

I'm using the formula '=LEFT(A2,4)+0 to shorten a numbered line of text.Is there a way to adopt that formula to do the same thing to an alphanumeric line of text (i.e. 80A0267AA1 to read 80A0267) or even better substitute a "-" in place of the "A" (i.e. 80A0267AA1 to read 80-0267)? I know this is really picky, but I figure it's worth a shot.

View 10 Replies View Related

Shorten Vba Code

Jun 26, 2007

it counts data in columns 4 to Endxlright and then creates a graph based on the status. I'm sure there is redundant code in there but can't seem to shorten it myself.

Option Explicit
Dim vEndCol, vTotal, nFail, nOth, vRow, vCol, nExc, nSum, n, x
Dim Mth As Integer
Dim Cell As Range
Dim vMth, vstMth, vstart, nOK, xRow, vStatus, wks, Chart

Private Sub Calcs()
Sheets("Report").Activate
'Clear previous data and formats
Range(Cells(2, 2), Cells(51, 30)).ClearContents
Range(Cells(2, 2), Cells(51, 30)).ClearFormats
Sheet1.Activate
'Identify last row of data
Range("IV8").End(xlToLeft).Select
vEndCol = ActiveCell.Column
'variables for all data...................

View 5 Replies View Related

Shorten Code: Clean This Up?

Mar 30, 2007

I am trying to run the following

ChDir _
"C:Documents and SettingsChrisDesktopRainforestMASTER LABORNew Master Labor"
Workbooks.Open Filename:= _
"C:Documents and SettingsChrisDesktopRainforestMASTER LABORNew Master Labor2 Tuesday.xls" _
, UpdateLinks:=0
Workbooks.Open Filename:= _
"C:Documents and SettingsChrisDesktopRainforestMASTER LABORNew Master Labor3 Wednesday.xls" _
, UpdateLinks:=0
Workbooks.Open Filename:= _
"C:Documents and SettingsChrisDesktopRainforestMASTER LABORNew Master Labor4 Thursday.xls" _
, UpdateLinks:=0
Workbooks.Open Filename:= _
"C:Documents and SettingsChrisDesktopRainforestMASTER LABORNew Master Labor5 Friday.xls" _
, UpdateLinks:=0...................

It worked for a short time but now I am having problems running it. I get an excel error that says excel can't continue. Someone said in a previous post that this could be cleaned up and consolidated. how to clean this up. It took me forever to get this right.

View 6 Replies View Related

How To Shorten Conditional String Construction

Feb 10, 2014

I'm developing a spreadsheet that is generating relatively simple source code. As far as excel is concerned, based on columns of data in the first sheet, generate other sheets - conceptually straightforward, but the formulas are getting stupid long. For example, suppose I have 4 columns:

Needs A, Needs B, Needs C, and Needs D.

If there is a "Y" in any of these columns, I need to generate corresponding text that is concatenated together:

=if(a1=="Y") use "Field1[if1]"
=if(b1=="Y") use "Field2[if2]"
=if(c1=="Y") use "Field3[if3]"
=if(d1=="Y") use "Field4[if4]"

The result in some other column could be (samples):

Field1[if1]
Field1[if1].Field2[if2]
Field3[if3]
Field2[if2].Field4[if4]

a couple of notes:

- you can have field 2 without field 1, etc.

- if there is a trailing field, then I need a period separating the two.

Needing this separating period between some of the columns is driving me bat crap crazy. My approach to this point is to build work sheets that feed the main page, thus isolating the logic complexity. This seems to be the only way to segment the processing into something one can edit.

View 3 Replies View Related

Shorten Code Typing Methods

Aug 11, 2007

Instead of typing out my code hundreds of times, I would like to replace it with an abbreviation or variable(?). Here is my example. If I have this in the wrong place please let me know. I want to replace Activecell.Interior.Colorindex with ACIC. I tried to Dim ACIC as range, variant, string...to no avail. In combination I Set ACIC = Activecell.Interior.Colorindex and that didn't work. I have been toiling with VBA for a year and I am still trying to learn the terminology and understand it so please forgive me if I seem really NOOBIE. :-)

View 9 Replies View Related

Shorten Cell's Content When Specific Conditions Are Met?

Feb 1, 2013

I have need of VBA code that will check collumn D, starting at cell 7 until cell 206, for when data that is entered starts with 100. When this occurs it will remove all of the data in that same cell except for the last 12 digits.

Here's an example.

When using our barcode scanner to capture a FedEx Tracking number the barcode captures the following:

1001853514360009020200802541997796.

Embedded in that long string of numbers (which are formatted as Text) is the tracking number. Specifically the last 12 numbers are the tracking number. However, FedEx varies this code at times so the last 12 numbers are the tracking number only with the raw data captured by the scanner starts with 100. Until I find additional conditions this VBA code will have to ignore all of data that is captured in collumn D starting at cell 7 until 206.

View 3 Replies View Related

Shorten String And Convert To Upper Case?

Mar 7, 2013

I got a list of counties in Texas, but the list is in mixed case and always has a " County" after each one. I got it converting to upper case, and have tried removing the " County" but no luck. Below is the code I have:

Code:
Sub TEXAS()
For a = 1 To 254
R = "D" & a
i = "a" & a
ActiveSheet.Range(R) = UCase(ActiveSheet.Range(i))
Next a
End Sub

View 7 Replies View Related

Easier Way To Shorten Up Part Of Code That Is Repetitive With Array

Jun 3, 2013

I have a macro that works but was wondering if there is an easier way to shorten up the part of the code that is very repetitive with an array or ? Nothing I have tried works except the code below.

Code:
Sub ClearAndReset()
Dim WS1 As Worksheet
Set WS1 = ActiveWorkbook.Worksheets("Stocks")
WS1.Unprotect
Application.EnableEvents = False
With WS1

[code]....

View 3 Replies View Related

Shorten This Query: If The Cell Doesnt Contain Any Info Dont Update

Apr 9, 2007

i have some code (see below). at the part where it says

If ActiveCell. Offset(0, 9).Value <> "" Then
.Fields("Skill_32") = ActiveCell.Offset(0, 9).Value

i want to make this smaller - i have to write this line bout 60 times 3 times over (incresing the numbers as i go ((0, 9..10..11 etc etc and (Skill_32..33..34 etc etc) )) to give you an idea of what im trying to accomplish - im opening and writing to a database but if the cell doesnt contain any info dont update.

Function EditCPS(ByVal StaffNumber As Long)
On Error Goto Err_Handler
Dim SkillsBuilderDB As Database
Dim RSSkillsBuilder As Recordset
Dim MySQL As String
Set SkillsBuilderDB = OpenDatabase(Worksheets("Adding Data").Range("IV1")) ' database location
MySQL = "select * from CPS where StaffNumber=" & StaffNumber
Set RSSkillsBuilder = SkillsBuilderDB.OpenRecordset(MySQL)
With RSSkillsBuilder
.Edit
If ActiveCell.Offset(0, 9).Value <> "" Then
.Fields("Skill_32") = ActiveCell.Offset(0, 9).Value
Else............................................

View 7 Replies View Related

Shorten String Length If Exceeds 31 Characters (max Sheet Name Length)

Mar 27, 2014

I've set up a filing system which saves sheets/ workbooks based on the value of a cell - Range("B1") Everything works great apart from when ThisFile String length exceeds 31 characters which you may know is the max useable character length for a sheet name - I had no idea! 8-0

Is there a way i can check if string length exceeds 31 characters then, if it does, shorten it to 31 characters?

[Code] .....

View 2 Replies View Related

Formula For Deleting A Formula When The Formula Has Done Its Calculation

Oct 7, 2009

I was wondering if there is a formla that will delete a formula when it has done its calculation, or stop the formula from constantly updating.

I've got a formula

=IF(COUNTA(A1)=1,TODAY(),"")

When something is typed in Cell A1 the cell with the formula will input todays date.

Is there a formula that will stop this formula from updating, as when you go into the file on a different day the date would have been updated.

View 6 Replies View Related

VBA To Read Text Formula And Related Constants And Insert As Formula Into Cell

Jul 30, 2014

I have a situation where I have to curve fit data, this can lead to different formulas being used with varying constants.

Is it possible to pickup a TEXT based formula and related constants from other cells, and then place this into another cell as a functioning formula. For Example

Cell A1 contains the formula as a text string whether it be y=a+bx+cx^2, or y=a+b/x, etc
Cells A2:A6 contain the individual constants, a, b, c, etc

I would then want the VBA to read the text based formula and put it into an output cell as a functioning excel formulae.g

In cell B10: =a+b*A10+c*A10^2

I understand picking the constants up and putting the formula should not be too much of an issue, however trying to insert the variable form of the curve fit is the part that I am struggling with, and am unsure if possible.

View 2 Replies View Related

Replace Cell References In Formula With The Header Of The Cells Referenced In Said Formula

Dec 22, 2009

Here is the scenario:
A B C D
BananasApplesOrangesTotal113=A1+B1+C1

I need to reference the formula in D1 with the cells headers names.

In a perfect world, it would take
=A1+B1+C1:

and produce:
=Bananas+Apples+Oranges

View 9 Replies View Related

Add Additional Formula To Existing Formula To Exclude Weekends And Holidays?

Mar 27, 2014

I have an existing formula in a cell linking back to a start date only. determining how to add an additional formula to exclude weekends, and possibly holidays.

View 2 Replies View Related

Concatenate Formula Nested Within IF Formula Is Not Producing Expected Results

Aug 24, 2014

I am trying to use a combination of Concatenate and IF formula to produce an email.

My input.

D4: First Name:
D5: Middle Name:
D6: Last Name:

D8: Organization:

Once all these are filled, I want the formula to produce a result like

FirstName.M.LastName@Organization.com

I have used the following formula.

[Code] .....

Problem is if there is a middle name the formula works fine, but in case where there is no middle name, it produces the following result.

FirstName..LastName@Organization.com

How do I remove the additional (.) in cases where there is no middle name.

Attached File : Email Generator.xlsx‎

View 3 Replies View Related

Vlookup Formula In VBA - Object Error (input A Formula Into A Cell)

Apr 23, 2009

I'm having some trouble trying to get excel to input a formula into a cell. I'm still a novice at VBA right now, so I don't think my problem will be too much of a brain buster.

I want a formula in Cell A6 (and I already know it correctly works) in this format: =E6&VLOOKUP(I6,'FA-Fund Data'!B$1:C$2000,2,FALSE)&J6

View 3 Replies View Related

When Dragging Formula Down The Formula Skips X Number Of Cells

Jul 22, 2014

Is it possible to write a formula that skips x number of cells and have the formula autoincrement as usual. For an examples lets say I want to skip 3 cells and I have entered in the cells listed:

A1= "1"
A2= "2"
A3= "3"

Then I type in the simple formula in the cell
B1= "=A1"

and then drag down but it skips 3 cells so then

B5= "=A2"

B9= "=A3"

If it didn't skip then
B1= "=A1"
B2= "=A2"
B3= "=A3"

this is just an example as I will be writing more complex formulas and need some thing that I can write into the formula so that it skips.

Something similar to this B1 "=A1(skip3cells)"

View 4 Replies View Related

Copy A Formula In A Cell And Then Paste Only The Text Of The Formula

Jul 16, 2007

I would like to copy a formula in a cell and then paste only the text of the formula, but I can't figure it out. Basically, I would like to avoid going into the cells and absolute referencing or hitting F2, then copying the text.

When I hit "Ctrl C" to copy the cell, then hit "Alt/E/S/F/Enter" to paste the formula, it is just like a regular copy/paste formula-wise in that the references move.

View 10 Replies View Related

Combine Formula Which Reduce The No. Of Additoanl Formula's Columns

Apr 9, 2009

I have some student marks in columns B to F. If some one get below 40 marks he fails and the subject in which he has been failed will come in Remarks column. If he has passed in all subjects remarks column will show Pass.

To bring failed subject initial in Remarks i have to create 5 additional column and then thru Concatenate i joined them.

Is There any formula to show fail subject in Remarks column without creating 5 additional columns?

View 14 Replies View Related

Add Addition If Condition To Existing Formula: Long Formula

Aug 12, 2007

This task joins a string together based on a number of characters per cell in the range.

I want to isolate one range, Col N, and add an IF condition to it.

There may be other issues preventing this from happening, e.g. the number of IF that exist in the complete formula. I will isolate the current cell and its requirements and then post the entire formula at the end for reference....

View 9 Replies View Related

Formula Arrays That Will Omit Empty Cells In My Formula

Jan 31, 2008

I am looking to average a range of cells which won't always be the same size. How do I create a formula array that will omit empty cells in my formula.

View 9 Replies View Related

Not Responding: Added A Formula To A Spreadsheet With Som Complicated Formula

Jun 1, 2006

I recently added a formula to a spreadsheet with som complicated formula. It worked ok and I saved the sheet. Now it takes 5 minutes to open the sheet and when I try to do anything,like delete the inserted column the program locks up giving a no responding message. I can do without this column if I have to.

View 4 Replies View Related

Replace Character Used In Formula Where Formula References Cell

Feb 23, 2008

I am using vlookup to get a cell value from another sheet, but if the cell has "&" or "/" I need to substitue "&" and "/" with "and" so that the cell can be added later to a url.

i am using =VLOOKUP(a1,Sheet2!A1:W17968,6) to get the value of a1 in sheet 2 and return the value of column 6

this will return "Audio Cables & Leads" but i need it to say Audio Cables and Leads

I need the formula to also check and replace "/" with "and" as well so cables/wire will be Cables and wire

View 9 Replies View Related

Adding Today Formula In A Countif Formula

Dec 19, 2012

I have a spreadsheet that contains a list of dates: What I need is a formula that will count the number of cells that hava a date more than 6 months old. I also would like the field automated so I don't have to change the date manually every day.

=COUNTIF(S5:S593,"<2012/06/18") This formula will give the correct read out, but I must change the date manually.

My attempts at adding a =today() command in place of the date result in 0 being the result (not correct)

This is what I have tried: =COUNTIF(S5:S593,"<"=TODAY()-"183")

View 8 Replies View Related

Add Total $ Value Formula Into Existing SUMIFS Formula?

Apr 3, 2014

In my attached spreadsheet example below, in the Rollup Data sheet, I have a formula (Cell: C17) that will give me the actual cost totals that has been invoiced on WBS Element (DWRRI-BW096-231) for a total of $35,004.81.

What I need the formula do is run a redundant check procedure on my new WBS Element (DWRRI-BW096-231) actual cost total formula in the Rollup Data sheet (Cell: C17) against/vs. what the SAP system provides in the raw SAP Excel export contained in the PTD-Actual Cost sheet for the WBS Element (DWRRI-BW096-231) actual cost total of $35,004.81 (Cell: F9) that's highlighted in the yellow row.

In the Rollup Data sheet (Cell: C18), I need this formula to perform a similar function the as the previous formula above it (Cell: C17), but it this formulas function (Cell: C18) would have a separate operation that would only look for and return the single/sole WBS Element (DWRRI-BW096-231) actual cost total contained in the PTD-Actual Cost sheet (Cell: F9).

In the Rollup Data sheet I could then compare my two WBS Element (DWRRI-BW096-231) actual costs totals, the first from the automated addition of all the individual matching WBS Element actual costs into an actual cost total (Cell: C17), the second (new formula I'm requesting) from the matching and return function of the single/sole WBS Element actual cost total (Cell: C18).

So, if the two separate WBS Element actual cost totals (Cells: C17 vs. C18) both equal $35,004.81, the formula in C17 is a success and has correctly identified and added all the actual costs contained in the PTD-Actual Cost sheet, but if the two separate WBS Element actual cost totals (Cells: C17 vs. C18) both do not equal $35,004.81, the formula in C17 failed for some reason and has not correctly identified and added all the required actual costs contained in the PTD-Actual Cost sheet.

How to Add Total $ Value Formula into an Existing SUMIFS Formula.xlsx

View 2 Replies View Related

Freezing The Formula After Certain Time / Formula Has Been Satisfied?

Aug 7, 2014

I am trying to create a graph of my data at the end of each month. The graph will show a count of the number of instances of each category in the data.

For example:

A1 =TODAY()B1 =MONTH(A1)

Column A from A3 down = 1,2,3,4,W,H,L
Column I between I2 and I140 = multiple instances of 1,2,3,4,W,H,L

July
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A3)),"0")
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A4)),"0")
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A5)),"0")
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A6)),"0")
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A7)),"0")
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A8)),"0")
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A9)),"0")
=IF($B$1=7,(COUNTIF($I$2:$I$140,$A10)),"0")

My problem is that when it comes around to August or the next month, I want the final count of July to be fixed/frozen so it won't change from the 1st of the month. I can then use the July column's data for my graph.

Can a formula convert itself into a value or freeze itself after certain criteria has been fulfilled?

View 7 Replies View Related

Vlookup Formula And Function To Combined With Another Formula?

Oct 22, 2013

i have two excel files which are data and master..both files will be use for salary calculating.. the vlookup formula will be use in master files for dragging the salary data from Data files..the formula as follow VLOOKUP(B4:B225,'D:Salary[Data.xls]AUG'!A$1:F$65536,6,FALSE))

the vlookup working fine to me.. but my problems is i want the data to be auto calculated when they have same value in two columns.. or if the name is similar/match in two columns (one for salary and another one for overtime), the salary should be auto calculated.

Data files will contain of these:
a:Employee ID
b:employee name
c:Employee salary/Overtime

Master files will contain of these:
a:Employee ID
b:Emplyee Name
c:Employee Nett Salary (that will be dragging from Data files)

is there any formula that i can used to combined with my vlookup formula?

View 4 Replies View Related

Searching Logical Formula And Also Formula For Combinations?

Feb 4, 2014

2 formulas that I need for my work (related with linear recurrences; this is serious work). First, I would like to know if is it possible to write a formula (or a set of formulas) that allows to write in a first column, in the first cell, the number 1 and in the following m cells, m distinct numbers chosen in a set S of n numbers (n > m); in the second column again the number one, and another set of m distinct numbers chosen in the same set S (here the order of the elements matters which means that the set {1,2} can be written as (1,2) and (2,1)). And I would like to do this until all the choices of m (ordered) numbers chosen in the set S are exhausted. Example: S = {2,3,4} which means that n=3. Suppose m=2. Then the columns would be

111111
223344
342423

The second formula I'm searching is (I think) a logical formula. What I would like is a formula that checks if the numbers in a fixed number of consecutive cells of a column are distinct and also non-null. If that's the case the formula should assign TRUE and if (at least) two cells are equal or (at least) one is zero, it would assign FALSE.

View 2 Replies View Related

Formula That Points To Another Cell With Formula To Finish First One?

Mar 5, 2014

I'm wondering if it's possible to write a formala that if a certain condition is met, performs a formula referenced in another cell. For example: Column A contains a list of formulas. In column B is the condition, let's use Work Type as an example. The result (or the formula I need) would be in column C. So if the work type is "Type1", then the formula in the corresponding column C cell would perform the formula in cell A5. If the work type is "Type8", then the formula in the corresponding column C cell would perform the formula in cell A2.

Is this possible to do without VBA?

View 6 Replies View Related







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