SMALL function with multiple IF statements (or alternative suggestion)

garymon

New Member
Joined
Feb 4, 2018
Messages
2
Hi, I am new to this forum and this is my 1st post for help.
I have outlined the problem below:


ABCDEFGHIJK
1Job number
visit date
Job type
Status

1st
2nd
3rd
4th
5th
223502-3
04/04/2017
Contract
Visit completed

1
2
3
4
5
323502-4
13/04/2017
Contract
Visit completed
23502





423502-5
07/06/2017
Contract
Visit completed
23509





523502-6
12/07/2017
Contract
Visit completed
623502-7
29/08/2017
Contract
Visit completed
For each 'job number' entered in column 'F', I want to insert the 1st, 2nd, 3rd etc occurrences of 'visit date' (Column 'B'), that relates to 'Job numbers' in column 'A', into cells under columns 'G3:K4'. However, only if they match the 'Job Type' "Contract" (Column 'C') AND the 'Status' "Visit Completed" (Column 'D').
I have tried the function 'SMALL' withmultiple 'IF' statements, but can't get it to work.
723502-8
11/10/2017
Contract
Visit completed
8s23502-8(1)
02/11/2017
Rodents
Visit completed
923502-9
21/11/2017
Contract
Contract Routine
1023502-10
18/01/2018
Contract
Visit completed
1123509-3
04/04/2017
Contract
Visit completed
1223509-4
13/04/2017
Contract
Visit completed
1323509-5
07/06/2017
Contract
Visit completed
1423509-6
12/07/2017
Contract
Visit completed
1523509-7
29/08/2017
Contract
Visit completed

<tbody>
</tbody>

This example is an extract of a larger spreadsheet with much more data variations in the descriptions in columns C and D.

If someone could give me the formula I need to enter in cells G3:K4, that gives me the date occurrences I need, I would be most grateful.

Forgive me if I have not got the forum etiquette or format correct. I am new to this. Any advice would be welcome.
Thank you.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
If you have data like this, you can use this:


Excel 2016
ABCD
1Job numbervisit dateJob typeStatus
223502-304/04/2017ContractVisit completed
323502-413/04/2017ContractVisit completed
423502-507/06/2017ContractVisit completed
523502-612/07/2017ContractVisit completed
623502-729/08/2017ContractVisit completed
723502-811/10/2017ContractVisit completed
8s23502-8(1)02/11/2017RodentsVisit completed
923502-921/11/2017ContractContract Routine
1023502-1018/01/2018ContractVisit completed
1123509-304/04/2017ContractVisit completed
1223509-413/04/2017ContractVisit completed
1323509-507/06/2017ContractVisit completed
1423509-612/07/2017ContractVisit completed
1523509-729/08/2017ContractVisit completed
15



Unknown
FGHIJKLMNO
11st2nd3rd4th5th
2123456789
323502 04/04/201713/04/201707/06/201712/07/201729/08/201711/10/2017
42350904/04/201713/04/201707/06/201712/07/201729/08/2017
5
6
7
8
9
10
15
Cell Formulas
RangeFormula
G3=SUMIFS($B$2:$B$15,$A$2:$A$15,$F3&"-"&G$2,$C$2:$C$15,"Contract",$D$2:$D$15,"Visit Completed")


Copy the formula down and across and use custom format with this: dd/mm/yyyy;"";"";@
 
Last edited:
Upvote 0
Hi Nishant94,

Thanks for your prompt reply and suggestion.
I cant't quite get it to work as I want, because your formula returns nothing in the 1st and 2nd occurrence columns (G-H).
I don't fully understand the part of your formula '$F3&"-"&G$2'. It seems to look for the suffix part of the numbers in column 'A'. e.g. because the 1st occurrence of the Job number 23502 has the suffix "- 3", your formula returns the date in the 3rd occurrence (column I). However, I need it to ignore the suffixes and return the 1st date occurrence of the job number into cell 'G3' as the 1st occurrence, regardless of suffix number.

I hope that makes sense.

Thank you for your help.

Regards,

garymon




If you have data like this, you can use this:

Excel 2016
ABCD
1Job numbervisit dateJob typeStatus
223502-304/04/2017ContractVisit completed
323502-413/04/2017ContractVisit completed
423502-507/06/2017ContractVisit completed
523502-612/07/2017ContractVisit completed
623502-729/08/2017ContractVisit completed
723502-811/10/2017ContractVisit completed
8s23502-8(1)02/11/2017RodentsVisit completed
923502-921/11/2017ContractContract Routine
1023502-1018/01/2018ContractVisit completed
1123509-304/04/2017ContractVisit completed
1223509-413/04/2017ContractVisit completed
1323509-507/06/2017ContractVisit completed
1423509-612/07/2017ContractVisit completed
1523509-729/08/2017ContractVisit completed

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
15



Unknown
FGHIJKLMNO
11st2nd3rd4th5th
2123456789
32350204/04/201713/04/201707/06/201712/07/201729/08/201711/10/2017
42350904/04/201713/04/201707/06/201712/07/201729/08/2017
5
6
7
8
9
10

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
15

Worksheet Formulas
CellFormula
G3=SUMIFS($B$2:$B$15,$A$2:$A$15,$F3&"-"&G$2,$C$2:$C$15,"Contract",$D$2:$D$15,"Visit Completed")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Copy the formula down and across and use custom format with this: dd/mm/yyyy;"";"";@
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

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