Grabbing data based on cell value

lburlock

New Member
Joined
Aug 17, 2021
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Good morning. I am not really macro savvy, so some help would be appreciated.

I have a form in one tab (Form) and data in the second tab (Schools). I need to be able to put the school data into the form based upon the value in a cell;

so value is in cell C22; based upon that value, I need the school name, address and phone numbers from the Schools tab to populate into cells on the forms tab

the form cells are
Program in C23 (data is in schools tab range A1-15)
Address in C24 (data range B1-15)
Address2 in C25 (data range C1-15)
Contact in C26 (data range D1-15)
Phone in I25 (data range E1-15)

I'm slowly learning! I've only done one other macro before and it was really helpful, but easy compared to this. Or am I overthinking it?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
"so value is in cell C22; based upon that value, I need the school name..."

What is based upon that value?
Given the value in C22 what should Excel match that against to retrieve the correct data from Schools tab A1-A15 B1-B15 C1-C15 D1-D15 E1-E15?
What I'm getting at here is you enter a value in C22, what are you then matching it against?

Why not just use a LOOKUP-type formula instead of a macro?
 
Upvote 0
Solution
"so value is in cell C22; based upon that value, I need the school name..."

What is based upon that value?
Given the value in C22 what should Excel match that against to retrieve the correct data from Schools tab A1-A15 B1-B15 C1-C15 D1-D15 E1-E15?
What I'm getting at here is you enter a value in C22, what are you then matching it against?

Why not just use a LOOKUP-type formula instead of a macro?
"Why not just use a LOOKUP-type formula instead of a macro?" good question, would a lookup be better? Like I said I'm super new to this and I am looking for the best solution.

So, for example, the value in C22 on the form tab is "MRS"
Based upon the value MRS, I want to bring the the relevant name, address, contact and phone number information from the School tab. There are 15 school choices to pick from.
 
Upvote 0
As per @Special-K99 's comments...
This is straight forward for a lookup formula solution.
However, in your "Schools" sheet, the data must have the school name in one of the columns - so that when you select that school name in C22 on your "Form" sheet, the formulae know where to look to match that school name - in order to know from which row in "School" to return the data.
So, EG - as per your example, one of the schools is presumably called "MRS" , and if this one's selected in C22, then the formulae find that in the "School name" column in "School" sheet, and return data accordingly.
You'd populate C22 with a data validation "List" filled from the "School name" column, then you'd have a drop-down, from which to select the list of available schools.
As long as you understand this, the formulae will follow on in subsequent posts (I've already made an example work, using Index & Match - a standard way of achieving this, and others will, no doubt, have their own suggestions).

HTH
 
Upvote 0
Thank you all. I opted for a simple Lookup formula and it works, so that's the important part, right? :)
 
Upvote 0
Jolly good - you're welcome.
Yes - simple, is (usually) the best way to do things. :)
 
Upvote 0

Forum statistics

Threads
1,215,055
Messages
6,122,902
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top