# Find Correct Data Based On 2 Variables

Oct 19, 2006

I have a project that looks at a table of train schedules for a range of dates. The data is formated so that arrivals and departures are on the same row but differnent columns. The dates are to the right and the grid is completed with the number of arrivals for a paticular day. I have created a formula that looks at the data and returns the arrival time for that date. It worked fine until the schedule was altered so that the same train could arrive at 2 different times on 2 different dates. So train 976 arrives at 4a on some days and 5a on others. In the example Ihave posted train 976 has 2 passengers arriving at 5a but the formula shows 4a. Is there a way I can have the formula return the correct time based on the day of the month? I should point out that the same problem could exist for departures.

## Correct Syntax For Function To Find Average Based On Background Color Of Cells In Range

May 20, 2014

I'm working on a workbook that will track staffing patterns.

The workbook has three worksheets: Sheet1 "RCS", Sheet2 "HCT' and Sheet3 "Hidden". I've attached the workbook to this thread. The password for the form is "j".

On Sheet3 "Hidden" I have two tables that are set up to collect the SUM of columns on Sheets1 "RCS" and Sheet2 "HCT". I'm finding the SUM of each range by way of the background color. I've set up the following formulas and when the "data collection tables" are in the same worksheets as the original information, the formula's work perfectly:

The following functions are pulling data from Sheet1 "RCS" and placing them into a table in Sheet2 "Hidden"

[Code] ........

The following functions are pulling data from Sheet1 "RCS" and placing them into a table in Sheet2 "Hidden"

[Code] .......

I have two more functions that aren't working due to the fact that the source values are percentages and NOT plain numbers. The above functions work great for SUM but not for percentages. EXAMPLE--Let's say, 3 sub percentages it gives me the SUM of the 3 percentages (i.e. 85% + 100% + 100% = 285% instead of giving me 95%.

[Code] ........

How might I use the following functions to find the average of the source fields instead of the SUM?

## Setting Correct Variables?

Oct 24, 2013

I have put together the below macro to take data from an Excel spreadsheet and place in a word documents (using bookmarks.

What should happen is it should open up the correct word template depending on what data is in column E (Servicecode) and fill in the bookmarks with the data from excel.

It all works fine and goes through the loop and saves, inputting the correct data into the bookmarks but after looking at the saved templates and scrolling through using F8 the IF ELSE does not seem to work. It CALLS theBearSSR macro rather than the relevant macro e.g. word in E2 is Cele, the macro should call the CeleSSR macro (which opens the correct template).

I don't think i have declared my DIM Servicecode correctly... I can't seem to figure out how to make the IF ELSE condition look at the Servicecode and then go to the correct sub routine (the difference between them is the template that is opened).

HTML Code:
Sub Celebration()

Dim departuredate As String[code]......

## Macro To Find Correct Data In Cells That Have Multiple Values

Jan 27, 2014

Script Example.png (Picture)
Script Example.xlsx (Example Workbook)

I have a report that I pull that I pull fairly often that is in this format and shows which footage of products each store is getting (out of over 1800 stores)!

Above is the format that it comes back as. And here is a spreadsheet that shows what steps I take to find correct values in detail.

So each FTG has an ID# and Desc. The ID is in text format and each ID is seperated with a comma, no space. Description also. Date is seperate by a space and comma. Stores change footages a lot so I want to find out which footage is effective today (1/27/2014) For ex: Store 63 would have the 5ft effective right now because we are between 5/23/08 and 5/22/14. So each ID# and Ftg Description is in the same order as Date.

When I have hundreds of stores, it is difficult to go through and get each one (even with the way I've been doing it.) But my ultimate goal is to create a macro to put only the current footage ID#, Desc, and Date in Columns C,D,and E. I'm not sure even where to start with doing a macro.

I usually just find the store with most ftgs, count them, insert that many rows after ID and Description columns, then do a text to columns (comma, delimited), sort by 2nd date column (so they all come up top) and then manually go through them and delete unneeded columns once I have them all.

## Check Cells Are Correct Format And Contain Correct Data

Jan 26, 2014

We receive about 20 sales files of several hundred lines of data each day from various agencies. I want to create a macro / VBA code which checks that the data submitted is correct so that we can upload it into our database without import errors and / or having to manually check each line of data.

I envisage something like an output report:

#####################
149 entries
Column A - Date - OK
Column B - Customer_Phone - Errors (Should be 11 digits)
Row 21 - Customer_Phone - Error (Not 11 digits)
Row 108 - Customer_Phone - Error (Contains letters)
Column C - Outcome - OK
#####################

## Disable TextBoxes And Input Correct Data Based On ComboBox Choice

Mar 24, 2014

when i choose material from my combobox Options (cboTM), i wanted, only the textboxes regarding to the sheet material unlocked, and the others locked with the color of the form, and the same for the other options like worklabor and equipments. i could blocked for material with this code :

[Code] .....

The prob is, worklabor and equipments will be blocked too, and i dont know how to put correct info on the textboxes.

Attached File : teste1.zip

## Looping Through Databased And Retrieving Data Based On 2 Variables

Feb 6, 2009

Another VBA problem I am having to need help with...

Andy Pope and DonkeyOte graciously helped me with the first stage here:

http://www.excelforum.com/excel-prog...-a-time-2.html

where I was trying to loop through 1000 records at a time and retrieve data from my Oracle database based on a single Field ID.

This is the code that ended up working...

## Excel 2007 :: Sum Data Based On Row And Column Variables

Sep 25, 2012

I'm working on a workbook that will combine a cash flow report by category and also by date. The categories can change (which I think is the easiest part) but so also can the frequency of data. For instance, you choose how you want to see the data, monthly, quarterly, annually and this will change the Row that the data should be summarized based off of.

Examples:
1) Annual: Sheet 1: Row = Rental Revenue and Column = 2001. I want to pull from sheet 2 all of the Rows that are mapped to Rental Revenue and all of the Columns that are mapped to 2001.
2) Quarterly: same idea but by quarter.
3) Monthly: No issue, just a SUMIF.

In Sheet 2 I have added a mapping at the top of each column for the Quarter, Year or Month that should be included in the Sheet 1 heading Row.

I tried using a sumproduct on both row and column using the whole data set underlying, but this did not work.

"=SUMPRODUCT(1*('Sheet 2'!\$A\$9:\$A\$140='Sheet 1'!\$C28)*('Sheet 2'!\$E\$9:\$GA\$9='Sheet 1'!E\$27)*('Sheet 2'!\$E\$10:\$GA\$140))",

It gives me a #N/A result.

I have tried to attach a table of what I am trying to do.

Sheet 1
Choose Frequency
1
Annual

[Code]....

## Code To Generate Data Table Based On Variables

Aug 26, 2008

I was trying to use the VBA code to generate a data table:

Private Sub createDataTable(WS As Worksheet, initialRow As Integer, numCol As Integer, numRows As Integer)
Dim initialCell As Range 'specify the upper left cell
Dim RefCell As Range 'the reference cell on the caculator sheet

'activate source sheet
ActiveWorkbook.Sheets("Calculator").Activate
Set RefCell = ActiveSheet.Cells(2, 3)
WS.Activate
Set initialCell = ActiveSheet.Cells(initialRow, 1)
initialCell.offset(numRows, numCol).Select
Selection.Table ColumnInput:=RefCell
'the calculation should be automatic, if not, then calculate
WS.Calculate
End Sub

and it kept giving me an input celll not valid error on this line: Selection.Table ColumnInput:=RefCell the thing is, I have defined RefCell as a range object, so it should be OK rite?

## Copy Input Data To Output Table Based On Variables

Mar 20, 2008

For what I'd like to do, the attached workbook actually represents 3 worksheet. one input sheet and two output sheets (output1 and output2)

I plan to use command button " CommandButton1" on input sheet to start the calculations

Here's what I want to do after pressing the " CommandButton1" :

1. start with case 1 and find the value of Input A to Input J from input table using Vlookup and paste those values to respective palceholder for inputs in blue colour area above the input table for each input.

2.for empty cell in the input table paste 0 (zero)

3. after this will give results for case 1 inputs on sheets "output1" and "output2" on basis of formulas used for each output

4.then copy the results for case 1 inputs from sheet "output1" and "output2" and paste them on "input sheet " in Output table (its below Input Table) next to case1

5.Do this for all cases (in actual workbook there will be more than 100 cases)

## Transfer Data To Separate Tables Based Two Variables (date And Site)

Oct 28, 2009

I have a spreadsheet where raw data is entered ("RAW_DATA") for each month it is collected. There are 7 questions that are tallied and each of those responses are transfered to a separate data table for analysis (7 individual tabs within the spreadsheet). I'm currently manually data entering the values from the raw data tab to the other seven tabs.

I would like to have VBA code that could transfer the data from one month ("RAW_DATA") onto the other 7 tabs based on the date and facility identified in the raw data tab. I have not attempted the VBA since I do not know where to start with searching on two variables.

## Find Function In VBA Returns A Date That Is Almost Correct

Feb 22, 2013

Is it possible to see why this code returns a date that is almost correct? Searching for 01.01.2005 I get 01.11.2005 as result. I would like the code to only show the correct date, and if it doesn't exist it should end up showing "nothing".

Code:
Set fstdate = wsOBX.Range("B1:B" & lr1).Find(what:=startdate, _
LookIn:=xlFormulas, lookat:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

## Find The Correct Formula To Sum Text That Meets Two Criteria?

Mar 27, 2014

I'm trying to find the correct formula to sum text that meets two criteria. If C2:C1023 is Equal to TEXT from J8 and F2:F1023 is equal to TEXT J4 add up the total times J4 shows up in C2:1023

=SUMPRODUCT(Sheet3!C2:C1023=J8,Sheet3!F2:F1023=J4,Sheet3!C2:C1023)

## Find (Using Find) Using Variables With Or Without Quotes

Sep 2, 2009

In the code below Dim "x" is a string, the string may or may not contain quotes ( "" ). I might search for a string like this:

The big brown fox
or like this:
The "big" brown fox

I just found out the string can not be found when it contains quotes as in my second example.

## Countif Formula: Added The Correct Amount In The Correct Cells

Feb 15, 2010

I'm trying to create a formula that will added the correct amount in the correct cells, I have create a dunny sheet in trying to achieve this. If Cell B8:B11 = ABS or Dum that any points won should be added to Cell L8:L11 right now its adding it into K8:K11. If Cell B8:B11 = is Blank any player points should be added to cells K8:K11. I'm using this formula throughout cells K8:K28 =IF(J8>J25,1,IF(AND(J8<>0,J8=J25),0.5,0)) Any thing in red is incorrect anything in blue is what I'm trying to achieve.

## Sumproduct- Counts The Correct Amount But Not With The Correct Dates

Jul 3, 2008

I have a table with 3 columns of dates and then a column with Set # that I
feel in the box #.

I need to see how many items processed for each set per day.

Example:
[url]

The problem is that it counts the correct amount but not with the correct
dates.
The formula that I use is:
=SUMPRODUCT(--(\$I\$3:\$I\$8<>"")*((\$C\$3:\$C\$8=39601)+AND(\$E\$3:\$E\$8=39601)+AND(\$G\$3:\$G\$8=39601)))

## Add Names Based On Number Of Question Correct

Oct 19, 2009

I need the names of students from Summative tab in the correct box based on how many question they got correct. (Q 27-32, (0-1, below, 2-3, Average, 4-5, Above Average, 6, Excellent Performance. )
I have attached a file.

## Print Correct Chart Based On Last Month

Jun 14, 2007

to print last months results each month. I have a cell (range name = LastMonth) with formula =now()-15 to display last months full name since I will always do this in the first half of each current month.

I want it to look at that cell on the "FY" sheet, see what month is displayed
then go to the "Monthly Audit By Cell" sheet & print the correct chart.

Each chart is named "Jan Audit" and so forth

I have this - only first six months done so far. Problem is nothing happens-no printing!

Doing this today on June 14th should print out the May chart.

' Print the Audit for the current month

## To Find The Power ( I.e. ^ N) When You Have Other Variables

Mar 12, 2009

To find the power ( i.e. ^ n) when you have other variables.

Mathematical Perspective as well as through EXCEL..

Ex: 5^n = 125

We know that 5^3 = 125,

Now if I have been given the value 5 and 125 , then how do i get the answer 3 ( i.e ^ n) value...

I need to solve a slightly complex issue and therefore need help for the above requirement as well as to get the "n" value..

## Loop Find With Variables

Nov 22, 2011

I have a process where I need to search for multiple customer numbers and delete line associated with them.

My question is how do I create this process to run in a loop going through all 10 numbers?

## Showing Correct Percentage Based On Monthly Figures

Mar 21, 2013

I have the following three columns of Data and I'm using this formula to calculate the %age difference cells:

=IF(ISERROR((F14-F13)/F13), " ", IF(ISBLANK(F14)," ",IF(F14=0,"-100%",(F14-F13)/F13)))

A - No. of Hits B - %age difference C - Weekly Average

25
50 100%
25 -50%
0 -100%
20
0 -100%
0
50

I have left blank the "cells" which are giving me trouble, and my troubles are as follow:

-Where the value of the previous month was 0 and the value of the current month is higher my output is Blank, ideally I would like this to show as 100%
-Where the value of two months in a row are 0 I would like the value to show as 0% for the second month

I did add extra into the formula so it would show the 100%, unfortunately it did this for any consecutive months at 0 also which was incorrect.

## Check If Abbreviation Used In Cell Is Correct Based On Given List?

Apr 24, 2013

I have a list of abbreviations in Sheet 2 and Names of Companies (Full name of Company and short name) in Sheet 1.

What I need to do is check if the abbreviation used in the Short Name Field in Sheet 1 is correct based on the given abbreviation list in Sheet 2.

here is the example:

Sheet 1:
Fulll Name of Company
Short name
AMERIPRISE FINANCIAL, INC.
Ameriprise Fin
Sheet 2: Abbreviation List
Full Version
Abbreviation
Bank
Bk
Financial
Finl

in the abbreviation list the correct abbreviation for financial is Finl so the short name should have been "Ameriprise Finl" and NOT "Ameriprise Fin". I'd like the rows highlighted in yellow if it is incorrect.

## Find First Value Greater Than X In Given Range Using Variables

Mar 3, 2014

My data has a bunch of near 0 figures followed by values I actually need followed by more irrelevant 0's than once again followed by values I need and again irrelevant 0's. Looks like

0.1
0.12
3.2
3.4
0.1
0.3
4.5
4.2
0.3
0.11

but with many more rows and numbers. I'm graphing the start and end values before/after zero's.

The first block of numbers I figured out using

=MATCH(TRUE,INDEX(\$C8:\$C150>1,0),0)+7 I then index from that given row.

The span of relevant values I'm looking for constantly changes, so once my numbers deviate too much I stop, using another index formula.

Now for finding my beginning and end points for the next block of data I've combined using VBA with excel formulas. I can't quite figure this part out. I've created Variables for ranges and then used them to find max and min Values.

Public Sub RunCurrent()
'
' RunCurrent Macro
Dim upEnd As Integer
Dim dnStart As Integer
Dim dnEnd As Integer

[Code] ........

## Find Value With Multiple Variables And Change Value In Other Column

Jul 3, 2014

In it I want to change name "G" in column A to "X" in column C.

And I want to do it for month of May in column B.

So a match won't do the trick because Name G is in 3 times so it should match on G and May from columns A and B.

How to catch this in a simple VBA line?

## Copy Correct Multiple Choice Answer Into Field Based On Number Identifier

Mar 23, 2014

I have a set of 4 multiple choice answers B,C,D,E column "F" lists a # 1-4 which lets you know which column letter (b,c,d,e) the correct answer is in. I want to set up a formula that will copy the contents of the correct answer (based on that # identifier) and copy it into column "A" which is currently blank.

## Index And Match Formula: Return The Correct Serial Number Based On Both The Matching

Jun 24, 2009

I'm trying to create a formula in cell f13 of my attached spreadsheet "Sample 1" that will search the 2nd attached spreadsheet "Sample 2" and return the correct serial number based on both the matching PO # (located in cell E10 on Sample Sheet 1 and in Column 5 on Sample Sheet 2) and Product # (cell A13 on my Sample Sheet 1). My current formula is not returning the correct result and I'm not sure why.

## Combining HLOOKUP AND VLOOKUP To Find Solutions In A Matrix Using 2 Variables

Oct 28, 2009

This was a snap in Lotus. Unfortunately, the VLOOKUP and HLOOKUP formulas don't translate to Excel on conversion. I need to estimate the weight of reinforcing steel in concrete based on 7 different sizes of rebar and spacing of the bar between 1" and 24".

I have created a matrix(lookup table) with the bar spacing listed in decimal equivilents in feet on the top row.Inthe row below, I have numbered the columns from 1 to 24. the next row is blank. Along the left side of the matrix, I have listed the bar sizes 3 thru 10. Within the table I have listed all the bar weights/SF of concrete. IE if the slab has 1 mat of #5 rebar spaced 6" oc. If you look in row 7, under column 6, the weight of weight of the bar in that sf of concrete is found. In the part of the worksheet where the caculations are performed set up as follows:.....

## Auto Open Macro To Find Correct Week Tab & Day/date In 52 Week Worksheets

Jan 19, 2010

I am new to VBA & not sure of the full understanding of code copied from a workbook which worked on the same principle but with Monthly (12) tabs. I thought if modified to show weeks, the macro would be able to locate the current week tab & day/date within - but upon opening, the cell stops at WK19 & column O - rather than WK43, Column N (which changes daily).

Sub Auto_Open()
week(1) = "WK1"
week(2) = "WK2"
week(3) = "WK3"
week(4) = "WK4"
week(5) = "WK5"
week(6) = "WK6"
week(7) = "WK7"
week(8) = "WK8"
week(9) = "WK9"
week(10) = "WK10"
week(11) = "WK11"
week(12) = "WK12"
week(13) = "WK13"
week(14) = "WK14"
week(15) = "WK15"
week(16) = "WK16"
week(17) = "WK17"
week(18) = "WK18"
week(19) = "WK19"
week(20) = "WK20"
week(21) = "WK21"
week(22) = "WK22"
week(23) = "WK23"
week(24) = "WK24"......................................

## Copy Correct Multiple Choice Answer Into Blank Field Based On Corresponding Number Identifier

Mar 23, 2014

Here's an example of what i want to do

A_________ B Frank Sinatra C Sammy Davis D Dean Martin E Joey Bishop F 3

I want to put "D"'s value 'Dean Martin' in column A - i know it belongs in A because the "3" in column F indicates its the 3rd answer listed i.e Dean Martin. This format would be the same where there are 4 possible answers on the column to the right dictates which answer is correct.

## UDF Needed To Get Correct Data

Jul 3, 2014

I need identifying correct title and corresponding company name. For this I need a UDF which looks for first occurrence of title having event or marketing or meeting word in data and if found the remove other titles and company names already separated with "/".

Sample Data
Producer, Target BTC@Periscope/Events Manager, Recognition Events@Minneapolis Park & Recreation Board/Event Producer@Events by JLS

Required Result
Events Manager, Recognition Events@Minneapolis Park & Recreation Board

Sample Data 2
Sales Associate@Teavana/Event Assistant@City of Saint Paul

Required Result 2
Event Assistant@City of Saint Paul

Sample Data 3
Sales and Catering Manager@Bunker Hills Golf Course at Town & Country Caterers/Marketing Coordinator@Town & Country Caterers

Required Result 3
Marketing Coordinator@Town & Country Caterers