Lookup number from Table with multiple entries

kachaloo

New Member
Joined
Jan 18, 2011
Messages
22
Office Version
  1. 2016
Platform
  1. Windows
Hello
I am struggling to find a solution and I really need please.

I have sheet as below
-----A-----B------C---------D-----------
1---NO---Firm----Name----Address-----
2---A1---Tesco--John----
3---A2---Asda---Smith---
4---A3---Tesco--Nick----
5---A4---Aldi----Mary---
6---A5---Asda---Jean---
7---A6---Asda---Mark

I want to return the NO (A2,A5,A6) for Asda to another sheet (Asda Wages) where I have 10 Cells like A1,A2,,,A9,A10
In Cell A1 I want A2
Cell A2 I want A5
Cell A3 I want A6
Ceall A4,,A10 should return 0.

Any help is appreciated.

Regards
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I do not know if this can be achieved by formula but PivotTable can give you this and VBA can also generate this:
Code:
Public Sub ListSpecifics()
Dim lLastRow As Long
Dim sSearchString As String
sSearchString = Application.InputBox(Prompt:="Please Select Range", Type:=8).Value2
lLastRow = Sheet1.Range("B" & Rows.Count).End(xlUp).Row
For i = 2 To lLastRow Step 1
    With Sheet1
        If .Range("B" & i).Value2 = sSearchString Then
        Sheet2.Range("A" & Rows.Count).End(xlUp)(2).Value2 = .Range("A" & i).Value2
        End If
    End With
Next i
End Sub
 
Upvote 0
Hello
I am struggling to find a solution and I really need please.

I have sheet as below
-----A-----B------C---------D-----------
1---NO---Firm----Name----Address-----
2---A1---Tesco--John----
3---A2---Asda---Smith---
4---A3---Tesco--Nick----
5---A4---Aldi----Mary---
6---A5---Asda---Jean---
7---A6---Asda---Mark

I want to return the NO (A2,A5,A6) for Asda to another sheet (Asda Wages) where I have 10 Cells like A1,A2,,,A9,A10
In Cell A1 I want A2
Cell A2 I want A5
Cell A3 I want A6
Ceall A4,,A10 should return 0.

Any help is appreciated.

Regards
Try this...

Book1
AB
1NOFirm
2A1Tesco
3A2Asda
4A3Tesco
5A4Aldi
6A5Asda
7A6Asda
Sheet1

Book1
ABC
1FirmCountNO
2Asda3A2
3__A5
4__A6
5__0
6__0
7__0
8__0
9__0
10__0
11__0
Sheet2

In the formulas I use the following named ranges:
  • Name: NO
  • Refers to: =Sheet1!$A:$A
  • Name: Firm
  • Refers to: =Sheet1!$B$2:$B$7
This formula entered in B2. This will return the count of records for the firm of interest.

=COUNTIF(Firm,A2)

Enter this array formula** in C2. This will extract the NO for the firm of interest.

=IF(ROWS(C$2:C2)>B$2,0,INDEX(NO,SMALL(IF(Firm=A$2,ROW(Firm)),ROWS(C$2:C2))))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Copy down a total of 10 cells to C11.
 
Upvote 0
This formula entered in B2. This will return the count of records for the firm of interest.

=COUNTIF(Firm,A2)

Enter this array formula** in C2. This will extract the NO for the firm of interest.

=IF(ROWS(C$2:C2)>B$2,0,INDEX(NO,SMALL(IF(Firm=A$2,ROW(Firm)),ROWS(C$2:C2))))

Thanks guys really appreciated.
I have tried the Pivot Table option before but I could not manage to get the output in order to another sheet.

However I have found the later suggestion by Valko exactly what I was looking for.

I like formula like these that I can see :)
I have to transposed the table in sheet 2 to get the No in order and used HLOOKUP to get the No in another sheet where the wages are calculated and wages slips are generated.

thanks Valko and Taurean
 
Upvote 0
Thanks guys really appreciated.
I have tried the Pivot Table option before but I could not manage to get the output in order to another sheet.

However I have found the later suggestion by Valko exactly what I was looking for.

I like formula like these that I can see :)
I have to transposed the table in sheet 2 to get the No in order and used HLOOKUP to get the No in another sheet where the wages are calculated and wages slips are generated.

thanks Valko and Taurean
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,712
Members
452,939
Latest member
WCrawford

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