# Macro For Populating Cells Using Variables From Another Column

Jun 20, 2006

I need to create a macro, where the contents of a particular cell are dependent upon summing values based on a word desription from another column. For instance, I would like cell E10 to include a numerical value from cell D5, but ONLY if cell C5 is populated with the word "trust" as opposed to "equity". Conversely, I would also have a macro in, say, cell E11 that would do the same for the word "equity" in column C. I would like the macro to hold for the entirety of different words in column C.

## Populating Sheet With Combinations Of Variables

Jul 11, 2013

I'm attempting to build a large (let's be honest for a second this is going to be enormous) spreadsheet for a project I'm working on and TBH I'd rather not do it by hand. With the scale of numbers I'm working with I'll miss something and it'll take forever.

Here's the deal:

I have 5 variables. They must add up to 100. I need to populate their area with all combinations/permutations of said variables in steps of 10. I'd like to do it in steps of 5 but I'm afraid that'd be too large.

Like so:

A
B
C
D
E
Sum

100
0
0
0
0
100

[Code] ....

It's been a while since I was in a math class dealing with combinations and permutations, so one of my questions is, how exactly would I phrase this mathematically?

## Automate Populating Values In Two Variables?

Jun 5, 2013

The attached table mimics the massive table that I am working with.

I wanted to populate values of two variables.

For e.g., I wanted to populate the yellow portion of the table with the value "A"; blue portion with the value "B"; Green portion with the value "3/1/1993" and so on (different colors were used to aid my question only, there are no such colors in the actual table).

I have about 700 such portions to be fill in.

My approach: I just started to copy and paste manually which is tedious.

Question: Would there be any automated way to do this?

## Populating Cells Based On Row And Column Labels Matching

Oct 24, 2013

Having a bit of trouble trying to get excel to pick up text in one sheet (sheet 2) and populate cells in another (sheet 1) if the row (row 1) labels and columns (column a) in both sheets match. hope that makes sense? I've tried googling this to no avail, i've also tried index-match however i keep getting errors.

## Add AVERAGE Formulas To Cells Using Variables In Macro Code

Apr 15, 2008

I am trying to have the formula =( SUMIF(S2:S125,">0",S2:S125))/(COUNTIF(S2:S125,">0")) Put into cells through vba. What I did to get the formula is typed it into an excel cell to find the average of a group of cells that do contain blank cells. The formula brought out the proper results. So all I did is put the formula into vba and changed the appropriate parts. The range will not be the same of course, but there is what I have.

ActiveCell.Formula = "=(SUMIF(" & ActiveCell.Offset(orow + 2, 0).Address & ":" & ActiveCell.Offset(-1, 0).Address & ","">0""" & "," & ActiveCell.Offset(orow + 2, 0).Address & ":" & ActiveCell.Offset(-1, 0).Address & "))/(COUNTIF(" & ActiveCell.Offset(orow + 2, 0).Address & ":" & ActiveCell.Offset(-1, 0).Address & ","">0""" & "))"

When I show a msgbox for ActiveCell.Formula (Msgbox activecell.formula), it shows me the formula as above - =(SUMIF(S2:S125,">0",S2:S125))/(COUNTIF(S2:S125,">0")) Except instead of the s:ranges, it shows \$L2:\$L125 (which is correct). The quotes do show up around the criteria in both the sumif and countif. I keep receiving an error. I put a msgbox err.description & ", " err.number dialog in. The error comes up as ", 0" (no quotes).

## Merge Cells: Select A Range Based On Two Variables Which Store The Column Numbers

Jul 19, 2009

I am trying to select a range based on two variables which store the column numbers. what I have is:

## Populating A Cell With A Column Header

May 13, 2013

I have a spreadsheet with a number of columns from a database export, where values in the column are either "TRUE" or "FALSE," Depending on whether or not the box was checked in the database. I am wondering if there is a way to populate a new cell with the text from the column if the value is "TRUE."

For example:

BOY
GIRL
John Doe
TRUE
FALSE

Is there a way that I could have another cell populated (I guess via function or macro) with "BOY," since the option for boy is true?

## Populating Worksheet Column From Combobox

Sep 3, 2009

I have a userform with comboboxes and listboxes etc. The comboboxes have drop down lists which are populated from data in columns from a worksheet.

1.) During the execution of the userform, a value is selected from the combobox, which is place in a column on another worksheet. So far so good. If I select the same value again, nothing shows up in the row below the first selection. If I choose a different value it shows up. I have tried using different properties of the combobox but have not been able to get around this.

2.) I would like, when the excel file is opened that the userform is ready to go, ie enter data. I have tried putting the
Private Sub Workbook_Open()
UserForm1.Show
End Sub

in "ThisWorkbook" module but have had no success with it.

## Populating Column In Excel From MS Word?

Nov 21, 2011

I am an intermediate MS Excel user and I have a question for those of you who are more savy. I am trying to figure out if it is possible to populate a field in Excel by reading the footer of a MS Word document.

## Populating A Combo Box With Column Headings

Mar 23, 2007

I am trying to write an advanced sorting macro that sorts on more than 3 columns. I need to poulate a combo box with the column headings, so that I can choose which column to sort on first, second etc. Now I am a complete beginner at this sort of thing, but I believe that ranges are required. I have tried using rowsource properties, but the combo box only ever displays one column heading.

## Populating A Range Of Cells

Oct 6, 2009

I am attaching an example sheet with this. I am trying to populate a range of cells in sheet1(from sheet2) based on value in cell A1 on sheet1. VLOOKUP brings only one cell value, I need to bring in a range of cell values in different cells on sheet1.

## Select Button And Starts Populating Column

May 4, 2007

I have this macro for a button that needs to start populating a column
with Xs. I want to populate cell F2 with data from a different sheet with Xs.

ub Create_button_macro()
Dim sButton

Set sButton = ActiveSheet.Buttons.Add(156.75, 36.75, 73.5, 22.5)
With sButton
.Characters.Text = "Program 1"
With .Font
.Name = "Arial"
End With
.OnAction = "Button1_Click"
End With

End Sub

Sub Button1_Click()

End Sub

## Referancing Cells And Populating Another Worksheet

Mar 24, 2009

I have two worksheets. One worksheet is pulling in data from an OLAP cude. I have it configured as a pivot table. The other worksheet contains my dataset. Both worksheets are in the same file.

In my datasheet worksheet I would like to pull in data from the other worksheet. I would like to be able start a few cells and then drag so that it autopopulates the values. Here is the formula I'm using

='Affiliates Pivot'!\$F10
='Affiliates Pivot'!\$F11
='Affiliates Pivot'!\$F12

it poulated with the values

23
45
64

then I select the 3 cells and drag so that I can autopulate the remaining values. It enters the formulas

='Affiliates Pivot'!\$F10
='Affiliates Pivot'!\$F11
='Affiliates Pivot'!\$F12
='Affiliates Pivot'!\$F10
='Affiliates Pivot'!\$F11
='Affiliates Pivot'!\$F12
='Affiliates Pivot'!\$F10
='Affiliates Pivot'!\$F11
='Affiliates Pivot'!\$F12

what I really want is

='Affiliates Pivot'!\$F10
='Affiliates Pivot'!\$F11
='Affiliates Pivot'!\$F12
='Affiliates Pivot'!\$F13
='Affiliates Pivot'!\$F14
='Affiliates Pivot'!\$F15
='Affiliates Pivot'!\$F16
='Affiliates Pivot'!\$F17
='Affiliates Pivot'!\$F18

Is this possible? How can I do this?

## Copying Row Into Worksheet After Populating Cells

Mar 26, 2009

I have the following simplified example:
Table with three columns with a growing number of rows. The user enters data into each row, once user enters the last value and hits "Enter" on the final cell (column c) I want a script to evaluate the row and copy the entire contents of the row onto an existing different worksheet. The first column (A) contains the attribute that will be the condition that determines which sheet to paste in

For example, in my attached file, the first row contains the value "Square".
I want that row be copied and pasted into the 2nd tab of the worksheet (reserved for "Square" data) on the next free line. Simiarly, Triangles should be pasted on the thrid tab. Note however that i think the data should be copied line-by-line as the user enters it, which obviously isnt the case for the example dummy data, its just there to simulate my setup

## Populating Cells With SQL Server Data

Jul 29, 2009

I need to run multiple queries and insert their results into Excel cells. Each query will return only one result (a number, or a null). What is the best way to accomplish this?

Below is an example of the code I'm currently using. It does return data to the cell specified, but I'm guessing there's an easier way to populate multiple cells with the results of multiple queries.

## Populating Cells When There Are Duplicate Conditions

Oct 22, 2008

if the state, city and company name are the same, I need to make sure the address gets populated in the address column. I have included an attached sheet to clear this up.

For example,

Row 1 is Crazy Horse Saloon in Anchorage, AK and has an address and phone number
Row 2 is Crazy Horse Saloon in Anchorage, AK and does not have an address and phone number

I need it to be able to realize that the State, City, and Business all match and populate the missing information.

## Populating Cells That Corresponds To The Time

Nov 14, 2006

I have a workbook that has a calendar look to it (in row 2 I have time in 30 minutes going from 7 AM, 7.5, 8, 8.5 until 12 AM). In sheet2 I have employees name in column A and their workshift in column B (07:00AM-03:45PM). I'm trying to have excel find an empty row to populate a "t" in sheet1 for the for the employees worshift for each associate without any overlap. I have attached a short sample of what I'm working with. Let me if there is a formula or a code maybe...

## Excel 2013 :: Populating Column Without Duplicate Values

Jul 14, 2014

I've got a column of client company names and because it is based from accounts, the companies names appear many times. I just need to populate a new column with unique names, so I have found a formula to do this:

=INDEX(\$A\$2:\$A\$20, MATCH(0, COUNTIF(\$B\$1:B1, \$A\$2:\$A\$20), 0))

However when I do this, I CtrlShiftEnter and drag to copy that down, and it's just a copy of the original list - client names are appearing on my new list multiple times. I don't see how this doesn't work... I'm using 2013.

## VLOOKUP - Copying Info From One Workbook To Another And Populating A Column

Feb 18, 2014

I am working on two worksheets, in different workbooks. They are both lists of customers and Worksheet 1 is 2500 rows & contains up to date data & Worksheet 2 is 20000+ & includes some that is outdated. Worksheet A data is all contained within worksheet B but I need to be able to update/compare them.

Each customer in worksheet A has two unique identifiers but in B there is only one. I want to be able to add in the missing unique identifier (numeric) from A to B, which will identify which customers are still active from worksheet B.

I have been trying to do a VLOOKUP so I can insert the relevant data from the cell from A to B but I'm getting a N/A error. My formula looks like this:

=VLOOKUP('[Netsuite customer details 17feb14.xlsx]Customers'!\$B\$2,'[Netsuite customer details 17feb14.xlsx]Customers'!\$A\$2:\$BE\$2549,2,FALSE)

## Populating Multiple Cells By Entering In Criteria

Jan 29, 2010

I am adding a sheet with a graph I made. There are two sheets, the first with the graph, the second with tables. What I would like to do is populate the graph based off what is entered into the tables. My main goal is to get the cells in the cells in the graph for each day to fill in color between the given time frame entered in on the table. Obviously I would be rounding up or down to make the time end in ":00."

The color I would like to fill the graph with is shown on the graph sheet. Also, if anyone can actually get this to work (I honestly wouldn't know where to start) Is there a way to have multiple colors and a possible overlay of colors?

Lets say on tuesday I have 10:00-15:00, and 12:00-18:00. Can I have two colors populate the cells and a thirs color populate the cells in the overlay which would be 12:00-15:00?

## Populating Specific Cells With SQL Server Data?

Dec 11, 2012

A user has an excel document and there are 5 specific cells they need to populate. The data is in one of our SQL databases. Is it possible to create a new copy of that excel doc with those fields populated for each record? There are around 2000 records they don't want to manually populate each one.

## Auto-populating Cells On Separate Sheets?

Jan 9, 2014

I have two spreadsheets, one is a Log Sheet for invoices that we have been printing out and filling in my hand throughout the day as our field technicians complete their work. The second spreadsheet has a sheet for each technician where we manually input the technician's invoice numbers and payroll for each job completed on that day.

What I'd like is a way to combine these spreadsheets so that instead of printing and filling in the first sheet by hand, I could input the invoice data and have it automatically populate the cells for the appropriate technician.

This is the running log we keep throughout the day:

2rp76ky.png

Then at the end of the day, we painstakingly transcribe the data for invoice number and payroll onto this sheet for each technician:

4vg6dk.png

What I want is for Excel to automatically fill in each technician's payroll log with invoice number and payroll time as we fill in the running log throughout the day, is this a doable thing?

## Auto Populating Cells From A Date Range

Nov 17, 2006

Basically i am trying to auto populate cells using two dates as the parameters, set up is

A1 - Start Date
B1 - Finish Date
C1 - Jan 07
D1 - Feb 07
E1 - Mar 07....and this carries on across till the end of the year.

What i am wanting excel to do is to be able to put in a start date and finish date in to the relevant cells.....this then populates a fixed figure across in to the correct month.

Eg
start date 05/07/07
finish date 17/10/07

This then puts in the figure 0.2 in to each cell that correspond with each month....July 07/Aug 07/Sep 07/Oct 07.

So in effect it is giving a gantt chart but with data in it.

One more thing....the start and finish dates could well be out of the range.....

eg
so start could be 07/08/06 and end could be 18/04/07 which would mean that all of the fields would need populating.

## Populating Many Cells From One Master Cell Formula

Aug 22, 2008

If I type a VLookup formula in Cell A1, the resultset goes into cell A1, as expected.

Is there any way to have a formula in Cell "A1" that populates a different cell, like Cell A6 that contains no formula ?

The reason I need this is that the user sometimes needs to type in manual data into Cell A6 and would overwrite the formulas. I was thinking that if I could have them actually type something into A1, it would populate other cells, such as A6, that did not have any formulas.

## Automatically Populating A Row Of Cells With Background Colour

Apr 3, 2009

I have five possible reps names in column A, when i type in "peter" i want that row up to column I to have a background colour of yellow, each rep must have his own colour. when i clear the name from column A the row should clear the colour. using conditional formating i can only get the first cell to get a background colour.

## Auto-Populating Empty Cells With Specific Text?

Dec 13, 2011

Is there a way to auto-populate all of the empty cells with the word "Need to Review" in a cell range (A1:A250)? Once any of the cells in this range is populated, whatever is inputted should house the cell.

## Setup A Macro To Copy Text From A Column Of Cells To Another Column

May 22, 2008

I have been working with a few people on here to setup a macro to copy text from a column of cells to another column and then print this in to a text document but it seams to have got stuck in a loop ....

## COUNT 2 Variables In One Column Against Another In Separate Column

Jun 17, 2013

I want a formula to do the following. Count all instances when column A contains S or A and column B = 1. The example below would equal 2 (ONES MEETING CRITERIA ARE IN BOLD).

Example

N 2
S 1
A 1
D 3
X 2

## How To Sum Variables In Column

Dec 2, 2013

I am making a weekly plan for machine inspection at the end of every column i need to sum how many machine will be inspected.

L= area
L1=10 ,) L1 has 10 machines ... this number can be change in the future that is why t is variable. for example:
L1=10, L2= 25, L3=20
week1
L1
L3
sum ?

## Dummy Variables In Column

Nov 25, 2009

i have data on number of employees in culomn A range from 1 to 10000. i need to generat four dummy variables in column B,C,D and E as the following

s=1 if number of employees 1-50 and zero otherwise
m=1 if number of employees 51-100 and zero otherwise
l=1 if number of employees 101-1000 and zero otherwise
xl=1 if number of employees 1001-10000 and zero otherwise